Hi, my self Ravi Vishwakarma. I have completed my studies at SPICBB Varanasi. now I completed MCA with 76% form Veer Bahadur Singh Purvanchal University Jaunpur.
SWE @ MindStick | Software Engineer | Web Developer | .Net Developer | Web Developer | Backend Engineer | .NET Core Developer
Ravi Vishwakarma
07-Jun-2024In C#, static, read-only, and const are all keywords used to create members of classes or variables with different behaviors. They serve distinct purposes and have different behaviors.
Static:
Example
Readonly:
Example :
Const:
Example -
Differences:
Use static for shared members, readonly for immutable instance fields, and const for compile-time constants whose values are known at compile time. Each serves a distinct purpose in C# programming and helps in designing maintainable and efficient code.