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.


Comments

Post a Comment

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -