Тема: .NET Generic
Показать сообщение отдельно
Старый 28.10.2013, 13:12   #12  
Cardagant is offline
Cardagant
Участник
 
317 / 54 (2) ++++
Регистрация: 11.10.2011
Спасибо за ответ! Но всё равно не выходит.

Попробую привести ситуацию подробнее

TMSoft.Gohub.Client.GohubConnection - Класс сборки, реализующий подключение к сторонней БД

TMSoft.Gohub.Client.GohubDocument - Класс сборки, реализующий объекты, коллекцию которых требуется получить.

X++:
System.Type                         enumerable;
System.Type                         enumerator;
System.Object                       CLRenumerable;
System.Object                       CLRenumerator;
System.Reflection.MethodInfo        methodInfo;
;

// Создаётся некоторое подключение
con = new TMSoft.Gohub.Client.GohubConnection(someparams);

// Получить коллекцию всех документов
// Описание функции говорит, что возвратит System.Collections.Generic.IEnumerable`1[TMSoft.Gohub.Client.GohubDocument]
CLRenumerable = con.QueryDocuments(0);

// Получить тип
enumerable = CLRenumerable.GetType();

info(enumerable.get_Name()); // <_QueryDocuments>d__0
info(enumerable.get_FullName()); // TMSoft.Gohub.Client.GohubConnection+<_QueryDocuments>d__0
info(enumerable.get_AssemblyQualifiedName()); // TMSoft.Gohub.Client.GohubConnection+<_QueryDocuments>d__0, TMSoft.Gohub.Client.Net, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

if (CLRInterop::isNull(enumerable)) // false
     throw error("null");

methodInfo = enumerable.GetMethod("GetEnumerator");

if (CLRInterop::isNull(methodInfo)) // true
     throw error("null"); 

CLRenumerator   = methodInfo1.Invoke(enumerable, nil);

Последний раз редактировалось Cardagant; 28.10.2013 в 13:18.