Methods inside enum in C#

后端 未结 6 1339
离开以前
离开以前 2020-12-04 10:21

In Java, it\'s possible to have methods inside an enum.

Is there such possibility in C# or is it just a string collection and that\'s it?

I tried to override

6条回答
  •  爱一瞬间的悲伤
    2020-12-04 11:21

    You can write an extension method for your enum:

    How to: Create a New Method for an Enumeration (C# Programming Guide)

提交回复
热议问题