|
![]() |
#1 |
Участник
|
Цитата:
Закоментировал проверку на Нулл, получаю ошибку на строке X++: CLRenumerator = methodInfo.Invoke(CLRenumerable, nil); Последний раз редактировалось Cardagant; 28.10.2013 в 14:25. |
|
![]() |
#2 |
Читатель
|
Попробуйте так:
X++: enumerable = System.Type::GetType("System.Collections.IEnumerable"); |
|
![]() |
#3 |
Участник
|
Благодарю Вас, 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). |
Теги |
.net, generic |
|
|