private void methodInsideAppDomain(string str) { object tmp = str; var act = EntityPtr.CastRef <List <A> >(tmp); Console.WriteLine(act.Count); }
static void Main(string[] args) { var lst = new List <AppDomainRunner.A> { new AppDomainRunner.A() }; AppDomainRunner.Go(EntityPtr.CastRef <string>(lst)); Console.ReadKey(); }
public void CastRefProvidedEq() { SetObject(new A()); object obj = GetObject(); for (int i = 0; i < Iter; i++) { SetObject(EntityPtr.CastRef <A>(obj)); } }
private static void CastingBetweenIncompatibleTypes() { // Create List of derived class instances var obj = new List <B>(); // Interpret it as List of base class instances var changed = EntityPtr.CastRef <List <A> >(obj); // call method changed.Add(new B()); // call another method Console.WriteLine("We cannot cast from List<B> to List<A> using C#, but can using CastRef<List<A>>(...):\r\n\"{0}\" is added using List<A> which is actually List<B>", changed[0]); }
private string CreateInstanceImpl(string typename) { return(EntityPtr.CastRef <string>(assembly.CreateInstance(typename))); }
public A Test_EntityPtr() { return(EntityPtr.CastRef <A>(instance)); }