예제 #1
0
파일: Program.cs 프로젝트: ypog07/dotnetex
        private void methodInsideAppDomain(string str)
        {
            object tmp = str;
            var    act = EntityPtr.CastRef <List <A> >(tmp);

            Console.WriteLine(act.Count);
        }
예제 #2
0
파일: Program.cs 프로젝트: ypog07/dotnetex
        static void Main(string[] args)
        {
            var lst = new List <AppDomainRunner.A> {
                new AppDomainRunner.A()
            };

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

            Console.ReadKey();
        }
예제 #3
0
파일: Program.cs 프로젝트: ypog07/dotnetex
        public void CastRefProvidedEq()
        {
            SetObject(new A());
            object obj = GetObject();

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