Тема: .NET Generic
Показать сообщение отдельно
Старый 28.10.2013, 17:24   #16  
Cardagant is offline
Cardagant
Участник
 
317 / 54 (2) ++++
Регистрация: 11.10.2011
Благодарю Вас, b_nosoff
Вы мне очень помогли.

Привожу код рабочего метода, в котором получаю XML-текст первого документа.
Мне нужен цикл, его, естественно, доделаю.

Очень благодарен всем, кто помог!

docum - это класс документа, определённый в сборке (TMSoft.Gohub.Client.GohubDocument)

X++:
con = new TMSoft.Gohub.Client.GohubConnection("localhost", 20295);

CLRenumerable = con.QueryDocuments(0);
// Получить тип
//enumerable = CLRenumerable.GetType();
enumerable = System.Type::GetType("System.Collections.IEnumerable");

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

methodInfo = enumerable.GetMethod("GetEnumerator");

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

CLRenumerator   = methodInfo.Invoke(CLRenumerable, nil);

if (CLRInterop::isNull(CLRenumerator))
     throw error("null");

enumerator  = System.Type::GetType("System.Collections.IEnumerator");

methodInfo = enumerator.GetMethod("MoveNext");

// Переход к первому элементу
b = methodInfo.Invoke(CLRenumerator, nil);
// считывание текущего элемента
if (b)
{
       // Сичтываю свойство с текущим документом
       ParameterInfo = enumerator.GetProperty("Current");
       // Получение текущего элемента
       docum = ParameterInfo.GetValue(CLRenumerator, nil);
       // ПОлучение документа в формате XML
       info(docum.GetXmlText());
}

Последний раз редактировалось Cardagant; 28.10.2013 в 17:40.
За это сообщение автора поблагодарили: Logger (5), MazZzDaI (1).