110,568
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Csharp
{
class People
{
private int myInt;
public int MyIntProp//这是什么玩意
{
get
{
return myInt;
}
set
{
myInt = value;
}
}
}
class Program
{
static void Main(string[] args)
{
People p = new People();
p.MyIntProp = 1;
Console.ReadKey();
}
}
}
public int myInt { get; set; }
下面这种写法还有点意义
public int myInt { get; private set; }
private int myInt;
public int Get_myInt()
{
return myInt;
}
public void Set_myInt(int value)
{
myInt = value;
}
当myInt与接口无关时,其实就是
public int myInt;
private int myInt;
public int MyIntProp
{
get
{
return myInt;
}
set
{
myInt = value;
}
}
这种写法就是脱裤子放屁。