C#C
C#3y ago
Theos

❔ Pass variable type as class parameter

Hey, so basically I have a class
class Number
{
  public string Type;
  public string Value;

  public Number(string type, string value)
  {
    Type = type;
    Value = value;
  }
}


What I want to do is if I do this for example
var num = new Number("long", "10000");

Number.Type shouldnt be string but rather a long;
and Number.Value should contain the value
Was this page helpful?