Почему нет предупреждения о присвоении личности?

I've made this mistake a number of times - it happens when I'm working quickly and using code completion. I end up with code like the following:

public class Model : IModel
{
    public PropertyNames PropertyNames { get; set; }
    public Model(PropertyNames propertyNames)
    {
        PropertyNames = PropertyNames;
    }
}

Then a test fails in a slightly less than obvious way, and I get bummed out.

I'm just curious if there's a valid reason to write code like that, ever, and if not, then does it make for a good candidate to generate a warning?

7
задан Aaron Anodide 14 May 2011 в 23:19
поделиться