Hello.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:1k
- using System;
- namespace Wrox.ProCSharp.Remoting
- {
- [Serializable]
- public class MySerialized
- {
- public MySerialized(int val)
- {
- a = val;
- }
- public void Foo()
- {
- Console.WriteLine("MySerialized.Foo called");
- }
- public int A
- {
- get
- {
- Console.WriteLine("MySerialized.A called");
- return a;
- }
- set
- {
- a = value;
- }
- }
- protected int a;
- }
- public class MyRemote : System.MarshalByRefObject
- {
- public MyRemote(int val)
- {
- a = val;
- }
- ~MyRemote()
- {
- Console.WriteLine("MyRemote destructor");
- }
- public void Foo()
- {
- Console.WriteLine("MyRemote.Foo called");
- }
- public int A
- {
- get
- {
- Console.WriteLine("MyRemote.A called");
- return a;
- }
- set
- {
- a = value;
- }
- }
- protected int a;
- }
- public class Hello : System.MarshalByRefObject
- {
- public Hello()
- {
- Console.WriteLine("Constructor called");
- }
- ~Hello()
- {
- Console.WriteLine("Destructor called");
- }
- public string Greeting(string name)
- {
- Console.WriteLine("Greeting called");
- return "Hello, " + name;
- }
- public MySerialized GetMySerialized()
- {
- return new MySerialized(4711);
- }
- public MyRemote GetMyRemote()
- {
- return new MyRemote(4712);
- }
- }
- }