Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Enum Is Defined Method

$
0
0

I have enum with flags attribute,

i receive enum values as string , then i do parsing,

and try to verify if enum is defined , using IsDefined method,

but the problem is , when enum to check has multiple value,

is defined method return false.

is this a standard behaviour of IsDefined method, or it's just me?

enum example:

    [Flags]
    enum Genre
    {
        None = 1,
        Comedy = 2,
        Drama = 4,
        Horror = 8,
        Romance = 16, 
        Fantasy = 32,
        Biography = 64,
    }

if variable of Genre type has Drama | Fantasy , that was parsed from string, IsDefined Method , doesn't recognize it and

returns false.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>