i am trying to develop a class for unlimited size integer values, all i need is to make a new custom constant suffix used with the assign operator.
For example:
lets assume the class name is BigInt and the Suffix created is B
the assign statement will be like this
// B character will tell the compiler about the New Data Type
BigInt x = 111111111111111111111111111111111111111111111111B;
is there any way to achieve this?
Special Regards
No. The language / compiler do not support this. Something close, which you might want to look into is an implicit conversion operator. That would let you do something like this:
BigInt b = "1234";
public class BigInt
{
public static implicit operator BigInt(string value)
{
return new BigInt {Value = value};
}
public string Value { get; private set; }
}
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