又有了新的问题
public string Details
{
get
{
return name + " is " + age.ToString();
这个不懂 请问get return 这些是不是C#中的默认的关键字
C#能够自动识别
去看C#的属性介绍。
C#Winform技术群:25380362
博客:http:///boyliupan/
// cs_operator_new.cs
// The new operator.
using System;
struct SampleStruct
{
public int x;
public int y;
public SampleStruct(int x, int y)
{
this.x = x;
this.y = y;
}
}
class SampleClass
{
public string name;
public int id;
public SampleClass() { }
public SampleClass(int id, string name)
{
this.id = id;
this.name = name;
}
}
class MainClass
{
static void Main()
{
// Create objects using default constructors:
SampleStruct Location1 = new SampleStruct();
SampleClass Employee1 = new SampleClass();
// Display values:
Console.WriteLine("Default values:");
Console.WriteLine(" Struct members: {0}, {1}",
Location1.x, Location1.y);
Console.WriteLine(" Class members: {0}, {1}",
Employee1.name, Employee1.id);
// Create objects using parameterized constructors:
SampleStruct Location2 = new SampleStruct(10, 20);
SampleClass Employee2 = new SampleClass(1234, "John Martin Smith");
// Display values:
Console.WriteLine("Assigned values:");
Console.WriteLine(" Struct members: {0}, {1}",
Location2.x, Location2.y);
Console.WriteLine(" Class members: {0}, {1}",
Employee2.name, Employee2.id);
}
}
--------------------
public SampleStruct(int x, int y)
{
this.x = x;
this.y = y;
}
自己问自己 这些 是干什么的 你们可以不回答 我知道我问的问题比较弱智了 。我自己看看书 说不定过几天就找到答案了~!