What to use besides enum for c#

后端 未结 3 1906
猫巷女王i
猫巷女王i 2021-02-06 00:04

So currently have an enumeration used on the status of an application. However, something feels off when using it against the ui. To many conversions between integer and string

3条回答
  •  孤街浪徒
    2021-02-06 00:25

    If you are working with a variable that has a finite and well-known number of possible states, then an enum is indeed the correct construct for you to use. There are many possible ways to make working with the UI more convenient, and you have cited two excellent ones, which are type converters and extension methods.

提交回复
热议问题