Why do we use internal classes for constants in C#? -
i have seen in many projects. why developers use internal classes store constant variables in c#?
for instance:
internal static class constants { public const double pi = 3.14159; public const int speedoflight = 300000; // km per sec. }
simply, designer decided class need used within same assembly. , not exposed or accessed project referencing assembly.
when download nuget package, can't access classes internal. developers decided don't need access these. these values "private" package.
more on access modifiers:
public :access not restricted.
protected :access limited containing class or types derived containing class.
internal: access limited current assembly.
protected internal : access limited current assembly or types derived containing class.
private : access limited containing type.
Download Video Player | Windows Media Player | Best Media Player
ReplyDelete