Пример #1
0
    public bool bTemp(IMyInterface2 imi)
    {
        Person p  = imi as Person;
        Person p2 = p;

        Console.WriteLine(p.Equals(p2));
        return(Equals(p2));
    }
Пример #2
0
        static void Main(string[] args)
        {
            MyClass myClass = new MyClass();

            IMyInterface1 myClass2 = myClass;
            var           name1    = myClass2.Name();

            Console.WriteLine(name1);

            IMyInterface2 myClass3 = myClass;
            var           name2    = myClass3.Name();

            Console.WriteLine(name2);
        }
Пример #3
0
        public void SimpleInterfaceProxy()
        {
            object proxy =
                generator.CreateInterfaceProxyWithTarget(typeof(IMyInterface2), new MyInterfaceImpl(), new StandardInterceptor());

            Assert.IsTrue(proxy.GetType().IsSerializable);

            IMyInterface2 inter = (IMyInterface2)proxy;

            inter.Name = "opa";
            Assert.AreEqual("opa", inter.Name);
            inter.Started = true;
            Assert.AreEqual(true, inter.Started);

            IMyInterface2 otherProxy = (IMyInterface2)SerializeAndDeserialize(proxy);

            Assert.AreEqual(inter.Name, otherProxy.Name);
            Assert.AreEqual(inter.Started, otherProxy.Started);
        }
Пример #4
0
 public bool bTemp(IMyInterface2 imi)
 {
     Person p = imi as Person;
     Person p2 = p;
     Console.WriteLine(p.Equals(p2));
     return Equals(p2);
 }
 static void UseIMyInterface2(IMyInterface2 obj)
 {
     Console.WriteLine("Wynik Tax2 " + obj.CountTax(12));
 }
Пример #6
0
 // 建構函式 2
 public YourClass(IMyInterface1 myInterface1, IMyInterface2 myInterface2)
 {
     Console.WriteLine("YourClass 建構式2(IMyInterface1, IMyInterface2) 被呼叫");
 }
Пример #7
0
 Person bTemp(IMyInterface2 imi)
 {
     Person p = imi as Person;
     p.Name = "Hata" + this.name;
     return p;
 }