public bool bTemp(IMyInterface2 imi) { Person p = imi as Person; Person p2 = p; Console.WriteLine(p.Equals(p2)); return(Equals(p2)); }
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); }
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); }
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)); }
// 建構函式 2 public YourClass(IMyInterface1 myInterface1, IMyInterface2 myInterface2) { Console.WriteLine("YourClass 建構式2(IMyInterface1, IMyInterface2) 被呼叫"); }
Person bTemp(IMyInterface2 imi) { Person p = imi as Person; p.Name = "Hata" + this.name; return p; }