I have a variable in a Class with the name of Id:
public class myClass
{
GUID Id;
}
How can I have polymorphism on the Id variable to Get either an int type or a GUID type?
I want something like this, but it only gets GUID or int:
EDIT:
public class myClass
{
Guid || int Id;
}
I want it so that the int or Guid is defined on initialization of the class.
You could make the class generic:
public class MyThing<T>
where T : struct
{
public T MyProperty { get; set; }
}
Which then can be used the following way:
MyThing<GUID>
MyThing<int>
But to give you a valid answer, it would certainly help to know what you are trying to achieve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With