日期:2014-05-18 浏览次数:20706 次
struct Currency { private delegate string GetAstring(); public uint Dollars; public ushort Cents; public Currency(uint Dollars, ushort Cents) { this.Dollars = Dollars; this.Cents = Cents; } public override string ToString() { return string.Format("${0}.{1,-2:00}", Dollars, Cents); } public static implicit operator float(Currency value) { return value.Dollars + (value.Cents / 100.0f); } static void Main(string[] args) { Currency balance = new Currency(50,35); Console.WriteLine(balance); //这里有疑问 }