using System;
namespace a
{
class Program
{
static void Main(string[] args)
{
ReferenceAndValue.Demonstrsition();
Console.ReadLine();
}
}
public class stamp
{
public string Name { get; set; }
public int Age { get; set; }
}
public static class ReferenceAndValue
{
public static void Demonstrsition()
{
stamp Stamp_1 = new stamp { Name = "Premiere", Age = 25 };
stamp Stamp_2 = new stamp { Name = "Again", Age = 47 };
int age = Stamp_1.Age;
Stamp_1.Age = 22;
stamp Stamp_3 = Stamp_2;
Stamp_2.Name = "Again Amend";
Console.WriteLine("Stamp_1's age:{()}", Stamp_1.Age);
Console.WriteLine("age's value:{()}", age);
Console.WriteLine("Stamp_2's name:{()}", Stamp_2.Name);
Console.WriteLine("Stamp_3's name:{()}", Stamp_3.Name);
}
}
}
报错:
引发的异常:“System.FormatException”(位于 System.Private.CoreLib.dll 中)
“System.FormatException”类型的未经处理的异常在 System.Private.CoreLib.dll 中发生
Input string was not in a correct format.引发的异常:“System.FormatException”(位于 System.Private.CoreLib.dll 中)
“System.FormatException”类型的未经处理的异常在 System.Private.CoreLib.dll 中发生
Input string was not in a correct format.