class1.cs

来自「C#开发教程 由浅入深 配有实例 是初学者的好帮手」· CS 代码 · 共 36 行

CS
36
字号
using System;
using System.Diagnostics;

namespace CondAttrib
{
	class Thing
	{
		private string name;
		public Thing(string name) 
		{ 
			this.name = name; 
			#if DEBUG
				SomeDebugFunc();
			#else
				SomeFunc();
			#endif
		}
		public void SomeFunc() 
			{ Console.WriteLine("SomeFunc"); }

		[Conditional("DEBUG")]
		[Conditional("ANDREW")]
		public void SomeDebugFunc() 
			{ Console.WriteLine("SomeDebugFunc"); }
	}

	public class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			Thing t = new Thing("T1");
		}
	}
}

⌨️ 快捷键说明

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