Const
Constant Fields वे Fields हैं जिन्हें Modified नहीं किया जा सकता। Declaration के समय, आपको इसमें Value Assign करनी होगी।
const int a = 5;
Static
यदि Static Modifier Class पर Apply किया जाता है तो आप New Keyword का उपयोग करके Class को Instantiate नहीं कर सकते। Methods, Properties, Classes, Constructors आदि पर Static Keyword का उपयोग कर सकते हैं।
static int a = 10;
Readonly
Readonly Field को Declaration के समय Initialize किया जाता है या आप इसे Constructor के भीतर भी Set कर सकते हैं।
आइए एक Example देखते हैं जिसमें Readonly Field को Constructor के अंदर Initialize किया गया है।
Example
class Demo { readonly int a; public Demo() { a = 5; } }