Back to Devexpress

XPMemberInfo.CollectionElementType Property

xpo-devexpress-dot-xpo-dot-metadata-dot-xpmemberinfo-a16f61b7.md

latest3.8 KB
Original Source

XPMemberInfo.CollectionElementType Property

Gets the XPClassInfo of the persistent object if the current member is a collection of these persistent objects.

Namespace : DevExpress.Xpo.Metadata

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public XPClassInfo CollectionElementType { get; }
vb
Public ReadOnly Property CollectionElementType As XPClassInfo

Property Value

TypeDescription
XPClassInfo

An XPClassInfo object which represents the type of a single element in the collection. null ( Nothing in Visual Basic) if this XPMemberInfo object provides metadata for a member which is not a collection.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the CollectionElementType 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.

XPO_how-to-implement-odata4-service-with-xpo-netcore/CS/ODataService/Helpers/ApiHelper.cs#L41

csharp
if(memberInfo.IsAssociationList) {
    var reference = uow.GetObjectByKey(memberInfo.CollectionElementType, relatedKey);
    var collection = (IList)memberInfo.GetValue(entity);

XPO_how-to-implement-odata4-service-with-xpo/CS/ODataService/Helpers/ApiHelper.cs#L50

csharp
if(memberInfo.IsAssociationList) {
    var reference = uow.GetObjectByKey(memberInfo.CollectionElementType, relatedKey);
    var collection = (IList)memberInfo.GetValue(entity);

XPO_how-to-get-a-list-of-a-persistent-objects-properties-e725/CS/Form1.cs#L123

csharp
foreach(XPMemberInfo m in xpoInfo.CollectionProperties) {
    string[] childProps = GetObjectProperties(m.CollectionElementType, processed);
    foreach(string child in childProps)

XPO_how-to-get-a-list-of-a-persistent-objects-properties-e725/VB/Form1.vb#L123

vb
For Each m As XPMemberInfo In xpoInfo.CollectionProperties
    Dim childProps As String() = GetObjectProperties(m.CollectionElementType, processed)
    For Each child As String In childProps

See Also

XPMemberInfo Class

XPMemberInfo Members

DevExpress.Xpo.Metadata Namespace