C# default visibility of properites
Is there a way to change the default visibility of properties and methods in C#? I'm writing code were pretty much everything needs to be public and the default for properties and methods is private and constantly typing pu开发者_开发知识库blic is getting really old.
You can't change these defaults. They are defined in the language spec.
Properties being private/internal by default is a design decision made by the C# team, there is no way to globally override it.
If you are using visual studio, you can use the code snippets for properties (prop
, propg
and propfull
). This can ease the pain of repeatedly typing in property code and will product the right syntax every time.
No, It's not possible to the change the default visibility of properties and methods in C#, since they are language dependents(ie language characteristics) , the user or programmers has no rights to change these things.
精彩评论