For money, I use a custom value type that contains only one decimal field. The simplified code is as follows.
public struct Money { private decimal _value; private Money(decimal money) { _value = Math.Round(money, 2, MidpointRounding.AwayFromZero); } public static implicit operator Money(decimal money) { return new Money(money); } public static explicit operator decimal(Money money) { return money._value; } }
When using this structure in my project, ambiguity sometimes occurs. And also sometimes I set object with a constant number, which should be Money . At the moment, I am initializing the object, for example,
object myObject=(Money)200;
Is it possible to assign a suffix to my custom Money type. I would like to initialize the object as follows.
object myObject=200p;
source share