class People
{
string name;
public string Name
{
get {
return name;
}set{ name=value;
}
}
和定义一个类people 用法有什么不同
namespace Ceshi
{
public struct People
{
public string name;
public int age;
public char sex;
}
class Program
{
static void Main(string[] args)
{
People onePeople;
onePeople.age = 18;
onePeople.name = "xiaolan";
onePeople.sex = '男';
}
}
} |
|