}
else if(m.Name.CompareTo("Set")==0 &&
object[] args = new object[1]; args[.0] = 14;
If ((bool) m.Invoke(reflectOb, args))
Console.WriteLine (" 14 x ");
else if(m.Name.CompareTo("Show")==0) {
M.Invoke(reflectOb, null);
}
}
}
}
.
:
MyClass(Int32 i)
MyClass(Int32 i, Int32 j)
.
MyClass(int, int)
: 10, : 20
reflectOb
30
14
Set(int, int). : 9, : 18 Set(double, double). : 1, : 23 : 1, : 23
MyClass. .
Constructorlnfo[] ci = t.GetConstructors ();
. , , .
for(x=0; < ci.Length; ++) {
Parameterlnfo[] pi = ci[x].GetParameters(); if(pi.Length == 2) break;
}
, , .
// , object[] consargs = new object[2]; consargs[0] = 10; consargs[1] = 20;
object reflectOb = ci[x].Invoke(consargs);
Invoke () reflectOb MyClass. .
, , , int. , .
MyClass , : MyClass. , , MyClass typeof , . , , .
16, , , . Reflection API , . , , . . , , , " ", , , , , . , .
|
|
Assembly. Assembly . Assembly . , LoadFrom (). :
static Assembly LoadFrom(string _)
_ - .