Цитата:
Сообщение от
VORP
Вызывать Generic функции из аксапты можно, если использовать .NET рефлекшен:
System.Reflection.MethodInfo - makeGenericMethod
Спасибо! Навело на мысль!!!
Я думал что, например, такой код из C#
X++:
System.Collections.Generic.List<int> l = new System.Collections.Generic.List<int>();
l.Add(1);
l.Add(2);
Console.WriteLine(l.Count);
В Аксапте сделать не реально. Но оказалось что можно, с изварещениями конечно:
X++:
static void Job67(Args _args)
{
System.Type type;
System.Object myIntList;
System.Reflection.MethodInfo methodAdd;
System.Reflection.PropertyInfo propertyCount;
System.Object[] parameters;
System.Object[] nil;
System.Object nl;
int cnt;
;
type = System.Type::GetType("System.Collections.Generic.List`1[System.Int32]");
myIntList = System.Activator::CreateInstance(type);
methodAdd = type.GetMethod("Add");
parameters = new System.Object[1]();
parameters.SetValue(1, 0);
methodAdd.Invoke(myIntList, parameters);
parameters.SetValue(2, 0);
methodAdd.Invoke(myIntList, parameters);
propertyCount = type.GetProperty("Count");
nil = new System.Object[0]();
cnt = propertyCount.GetValue(myIntList, nil);
info(strFmt("%1", cnt));
}
Может поможет кому...