using System; using System.Reflection; using System.Text; public class MonType { public void Afficher(int x) { Console.WriteLine(x); } } public class Example { static void Main() { Object o = Activator.CreateInstance(typeof(StringBuilder)); StringBuilder sb = (StringBuilder) o; sb.Append("Bonjour, là."); Console.WriteLine(sb); System.Runtime.Remoting.ObjectHandle oh = Activator.CreateInstanceFrom(Assembly.GetEntryAssembly().CodeBase, typeof(MonType).FullName); MonType st = (MonType) oh.Unwrap(); st.Afficher(5); } } |
0