Back to Devexpress

XPCollection.ObjectClassInfo Property

xpo-devexpress-dot-xpo-dot-xpcollection.md

latest3.8 KB
Original Source

XPCollection.ObjectClassInfo Property

Gets or sets the metadata information that describes the type of objects stored in the current collection.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[DefaultValue(null)]
public XPClassInfo ObjectClassInfo { get; set; }
vb
<DefaultValue(Nothing)>
Public Property ObjectClassInfo As XPClassInfo

Property Value

TypeDefaultDescription
XPClassInfonull

The XPClassInfo of the persistent object stored in the collection.

|

Remarks

Do not change this property manually in your code as it is intended to provide design-time support for the component. To specify the type of objects that will be stored in the collection use an appropriate XPCollection constructor.

By default, assemblies from project references are not loaded into the current application domain by Visual Studio. As a result, types declared in external assemblies are not added to the ObjectClassInfo combo box in the designer. To trigger loading types from a specific assembly, access any of these types in the form/component initialization code.

csharp
public partial class MyForm : XtraForm {
    public MyForm() {
        // Triggers loading MyAssembly.Model assembly into the AppDomain:
        typeof(MyAssembly.Model.MyObject).ToString();
        InitializeComponent();
    }
    // ...
}
vb
Partial Public Class MyForm
    Inherits XtraForm

    Public Sub New()
        ' Triggers loading MyAssembly.Model assembly into the AppDomain: 
        GetType(MyAssembly.Model.MyObject).ToString()
        InitializeComponent()
    End Sub
    ' ... 
End Class

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ObjectClassInfo property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-filtercontrol-implement-ifilteredcomponent/CS/Q200298/Helper.cs#L78

csharp
private FilterColumnProperties CreateColumnFromNestedProperty(string property) {
    XPTypeInfo member = source.ObjectClassInfo;
    string displayName = ProcessNestedProperty(ref property, ref member);

winforms-filtercontrol-implement-ifilteredcomponent/VB/Q200298/Helper.vb#L95

vb
Private Function CreateColumnFromNestedProperty(ByVal [property] As String) As FilterColumnProperties
    Dim member As XPTypeInfo = sourceField.ObjectClassInfo
    Dim displayName As String = ProcessNestedProperty([property], member)

See Also

XPCollection Class

XPCollection Members

DevExpress.Xpo Namespace