Код: Выделить всё
public class Test
{
public A[] ArrayA { get;set; }
}
public class A
{
public string P1 { get;set; }
public int P2 { get;set; }
}
Например:
Код: Выделить всё
Test a = new Test();
Test b = new Test();
// fill them with some info.
var props = typeof(Test).GetProperties();
foreach (var prop in props)
{
var arrayA = prop.GetValue(a);
var arrayB = prop.GetValue(b);
for (int i = 0; i < arrayA.Lenght; i++)
{
var item1 = arrayA.GetValue(i);
var item2 = arrayB.GetValue(i);
// Do Comparison of item1 and item2
}
}
К вашему сведению. Меня не интересуют какие-либо другие решения, кроме использования отражения. Я уже знаю, как это сделать.
Подробнее здесь: https://stackoverflow.com/questions/792 ... lement-typ
Мобильная версия