1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
class St
{
string nom;
Type type;
public St(string nm, Type t) { nom = nm; type=t; }
}
class Champ<T>
{
T _Value;
public T { get { return _Value; } }
public Champ(T value)
{
_Value = value;
}
}
class Test
{
public Test(St[] st, object[] objets)
{
St[] Sts = new St[3];
Sts[0] = new St("nom1", typeof(Array) );
Sts[1] = new St("nom2", typeof(bool) );
Sts[2] = new St("nom3", typeof(int[]) );
object[] obj = new object[3];
object[0] = (object) new Array() {1, 2, 3};
object[1] = (object) true;
object[2] = (object) new int[] {1, 2, 3};
List<object> resultat = Process(Sts, obj);
}
public Process (St[] st, object[] objets)
Type t ;
List<object> liste = new List<object>();
for( int i = 0; i < 3; i++ )
{
t = (Sts[i].type);
liste.Add( (object) new Champ<t>( (t) objets[i]) );
}
} |
Partager