How to determine if a given Integer is in a particular Enum?

后端 未结 4 1583
你的背包
你的背包 2021-02-18 20:13

In VB.NET, even with Option Strict on, it\'s possible to pass an Enum around as an Integer.

In my particular situation, someone\'s using an enum similar to

4条回答
  •  梦如初夏
    2021-02-18 21:12

    There is an Enum.TryParse in .NET 4.

    Although Enum.IsDefined probably suits your needs better.

提交回复
热议问题