⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class1.cs

📁 C#开发教程 由浅入深 配有实例 是初学者的好帮手
💻 CS
字号:
using System;

namespace RefTest1
{
	public class Foo
	{
		public int i;
	}

	class RefTest1App
	{
		[STAThread]
		static void Main(string[] args)
		{
			Foo test1 = new Foo();
			test1.i = 1;

			Foo test2 = new Foo();
			test2.i = 2;

			Console.WriteLine(
				"BEFORE OBJECT ASSIGNMENT");
			Console.WriteLine("test1.i={0}", test1.i);
			Console.WriteLine("test2.i={0}", test2.i);
			Console.WriteLine();

			test1 = test2;

			Console.WriteLine(
				"AFTER OBJECT ASSIGNMENT");
			Console.WriteLine("test1.i={0}", test1.i);
			Console.WriteLine("test2.i={0}", test2.i);
			Console.WriteLine();

			test1.i = 42;

			Console.WriteLine(
				"AFTER CHANGE TO ONLY TEST1 MEMBER");
			Console.WriteLine("test1.i={0}", test1.i);
			Console.WriteLine("test2.i={0}", test2.i);
		}
	}
}

⌨️ 快捷键说明

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