Assertfail

All Posts assertfail

View the Blog on GitHub wallymathieu

Public/protected/private fail?

12 Dec 2010

How many times are you writing these keywords? For many of the things I write I don’t feel that these keywords add to the readability of the code. It would be sweet to be able to specify on for example assembly level the default visibility of your code. Or perhaps some short version of the keywords?

$ class Comment {
_ id; //private
$ Id { get{ return id;} set{ id=value;} } //public
@ someValue = “”;//protected
}

Or let the visibility be govern by name convention if you set some flag in assemblyinfo.cs ?
class Comment {
_id; //private
Id { get{ return id;} set{ id=value;} } //public
someValue = “”;//protected
}

These keywords sometimes contribute to the noise in the application.

Using a preprocessor you could get these features today, but that would not work well with the visual studio tooling.

Tags

  • visual_studio
  • c#
  • Comments or errors? Fork post and do a pull request on github