DEV Community

Calin Baenen
Calin Baenen

Posted on

How can I store all kinds of number in the same variable in C#?

Is there a C# equivalent of Java's Number class?
Is there a way to store multiple kinds of numbers in a single variable in C#?

Thanks!
Cheers!

Top comments (1)

Collapse
 
thefern profile image
Fernando B 🚀

I think what you're looking for is Generics.

docs.microsoft.com/en-us/dotnet/ap...