© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
15 replies
13eck

Hope to declare class member with variable type

I’m making a simple dice rolling Discord app and I’m having issues creating classes for some of the data types as they have variable type members.

Specifically, the Application command interaction data option has a
value
value
field that can be a string, integer, double, or boolean.

How do I accommodate this in a class? I’m honestly thinking of just reading from a
JsonDocument
JsonDocument
and not worrying about it, but that can’t be a good idea, long-term, right?
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

Similar Threads

❔ Pass variable type as class parameter
C#CC# / help
3y ago
cannot convert from 'TypeA' to 'TypeB' with generics
C#CC# / help
2y ago
✅ Can a variable be of a type of variable or class?
C#CC# / help
3y ago