📄 program.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace _2
{
class ShallowCopy : ICloneable
{
public int[] arrayA = { 10, 20, 30 };
public Object Clone()
{
return this.MemberwiseClone();
}
public void Display()
{
foreach (int i in arrayA)
{
Console.Write(i + ", ");
}
Console.WriteLine();
}
}
class Client
{
public static void Main()
{
ShallowCopy A = new ShallowCopy();
ShallowCopy CopyA = (ShallowCopy)A.Clone();
A.arrayA[0] = 100;
Console.WriteLine("原型:");
A.Display();
Console.WriteLine("复制原型:");
CopyA.Display();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -