小编Adr*_*ien的帖子

使用属性时出现C#模糊错误

我最近开始学习C#.我刚刚了解了属性,并决定制作一个简单的程序,以便更好地理解它们.这是我写的代码:

  class Dog
{
    private int weight;
    private string colour;
    public string colour { get; set; }
    public Dog(int theWeight, string theColour)
    {
        weight = theWeight;
        colour = theColour;
    }
}
Run Code Online (Sandbox Code Playgroud)

我得到一个模棱两可的错误.据我所知,这不应该发生.

c# properties ambiguity

5
推荐指数
3
解决办法
5612
查看次数

标签 统计

ambiguity ×1

c# ×1

properties ×1