© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
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#
Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Next page
Similar Threads
✅ Casting to enum when only having a Type object
C
C# / help
2y ago
❔ How does class casting work?
C
C# / help
3y ago
✅ Replace enum with class name
C
C# / help
3y ago
Enum vs string const class
C
C# / help
4y ago