5

So I often write code where I have a model class and usually use the shortcut 'Ctrl + .' to give me the option to add a field or property to the class that I have typed out that does not yet exist. IN VS 2010,2012,2013 etc it would create a public property I.E.

public decimal? adRevenuePercentPartnerSold { get; set; }

Where as now it creates it with an internal set

public decimal? adRevenuePercentPartnerSold { get; internal set; }

This drives me crazy as when I test an MVC action the property never gets set from a post so I always have to go in and fix each property it creates.

Hamid Pourjam
  • 20,441
  • 9
  • 58
  • 74
runxc1 Bret Ferrier
  • 8,096
  • 14
  • 61
  • 100
  • It generates a public one for me... do you have any other plugins installed? – Jon Skeet Aug 26 '15 at 16:46
  • 2
    Ah - it looks like it depends on where you generate it from, or what you're doing. If you generate it from a call to the setter, in the same class, it's fully public... generate it from a call to the getter elsewhere, it's public get / internal set. Interesting. – Jon Skeet Aug 26 '15 at 16:48
  • 1
    I wonder if this changed as it probably uses Roslyn to implement this now. It is not a good behavior as it took me a while to figure out why some properties were not getting set when trying to do some basic CRUD – runxc1 Bret Ferrier Aug 27 '15 at 18:40
  • Well, it's not the behaviour *you* happen to desire - but it may well be exactly the behaviour others desire... – Jon Skeet Aug 27 '15 at 18:42

0 Answers0