定义属性的问题
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
class recaver
{
private double x, y, z;
public double x
{
get { return x; }
set { x = value; }
}
}
}
这样定义X属性不对吗???编译不过去啊,哪位大师帮解决下
------解决方案--------------------
属性名和私有变量名重名了
C# code
class recaver
{
private double _x, y, z;
public double x
{
get { return _x; }
set { _x = value; }
}
}