© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
113 replies
XE SparkyCracked

Casting object to enum class

So I have:
enum AClass { double, int, string } 
enum AClass { double, int, string } 

And I wanna case my object to that class:
obj a = 0;
(AClass)a;
obj a = 0;
(AClass)a;

There is a reflector to determine what variable type it is but it kinda does this on runtime/compile.

I wanna know if there is a way to cast this without wrapping it
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

✅ Casting to enum when only having a Type object
C#CC# / help
2y ago
❔ How does class casting work?
C#CC# / help
3y ago
✅ Replace enum with class name
C#CC# / help
3y ago
Enum vs string const class
C#CC# / help
4y ago