General CS question about constants

后端 未结 7 1454
旧巷少年郎
旧巷少年郎 2021-01-24 02:41

I\'m programming using C#, after programming on C. So I\'m using a lot of constants such as \"DEFAULT_USER_ID\", \"REMOTE_ADDRESS\" and such...

It seems to me that it\'s

7条回答
  •  独厮守ぢ
    2021-01-24 03:07

    You can use static or readonly properties, for instance, for App class

    class MyClass {
    
    public static readonly int myVal=10;
    
    }
    

提交回复
热议问题