hello.cs

来自「Professional C# 2nd Edition」· CS 代码 · 共 37 行

CS
37
字号
using System;
using System.Runtime.Remoting.Lifetime;

namespace Wrox.ProfessionalCSharp
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	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 override Object InitializeLifetimeService()
		{
			ILease lease = (ILease)base.InitializeLifetimeService();
			lease.InitialLeaseTime = TimeSpan.FromMinutes(10);
			lease.RenewOnCallTime = TimeSpan.FromSeconds(40);

			return lease;
		} */
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?