Hello I need to get two collections as XpCollections, but “cMemberInfo.GetValue(this)” brings me type “DevExpress.Xpo.XPCollection`1” is it possible to convert it in some way to the
DevExpress.Xpo.XPCollection?
XPCollection cColl1 = cMemberInfo.GetValue(this) as XPCollection;
XPCollection cColl2 = cMemberInfo.GetValue(cObject) as XPCollection;
As the result of not converting type both cColl are null
there is full part of code where these collections are used
foreach (XPMemberInfo cMemberInfo in ClassInfo.CollectionProperties)
{
XPCollection cColl1 = cMemberInfo.GetValue(this) as XPCollection;
XPCollection cColl2 = cMemberInfo.GetValue(cObject) as XPCollection;
if (cColl1 == null || cColl2 == null) { Debug.Assert(false); return false; }
if (cColl1.Count != cColl2.Count) { return false; }
for (int i = 0; i < cColl1.Count; ++i)
{
XPOBase cObj1 = cColl1[i] as XPOBase;
XPOBase cObj2 = cColl2[i] as XPOBase;
bRet &= cObj1.IsDataEqual(cObj2);
}
}
if I use XPBaseCollection in case of XPCollection I cannot declare cColl1[i] or cColl2[i]
GetValue is returning a generic
XPCollection<T>where T is the type of the objects of the collection.Or you could use
XPBaseCollectioninstead: