Ejemplo n.º 1
0
        private void methodInsideAppDomain(string str)
        {
            object tmp = str;
            var    act = EntityPtr.CastRef <List <A> >(tmp);

            Console.WriteLine(act.Count);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var lst = new List <AppDomainRunner.A> {
                new AppDomainRunner.A()
            };

            AppDomainRunner.Go(EntityPtr.CastRef <string>(lst));

            Console.ReadKey();
        }
Ejemplo n.º 3
0
        public void CastRefProvidedEq()
        {
            SetObject(new A());
            object obj = GetObject();

            for (int i = 0; i < Iter; i++)
            {
                SetObject(EntityPtr.CastRef <A>(obj));
            }
        }
Ejemplo n.º 4
0
        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]);
        }
Ejemplo n.º 5
0
 private string CreateInstanceImpl(string typename)
 {
     return(EntityPtr.CastRef <string>(assembly.CreateInstance(typename)));
 }
Ejemplo n.º 6
0
 public A Test_EntityPtr()
 {
     return(EntityPtr.CastRef <A>(instance));
 }