爲什麼微軟重載方法Console.Write()和Console.WriteLine()?他們可以使方法這樣爲什麼微軟重載方法Console.Write()和Console.WriteLine()? C#
public void WriteLine(Object ob)
{
Console.WriteLine(ob.ToString());
}
public static void WriteLine(string value);
但他們讓
public static void WriteLine(bool value);
public static void WriteLine(float value);
public static void WriteLine(int value);
[CLSCompliant(false)]
public static void WriteLine(uint value);
public static void WriteLine(long value);
[CLSCompliant(false)]
public static void WriteLine(ulong value);
public static void WriteLine(object value);
public static void WriteLine(string value);
public static void WriteLine(double value);
public static void WriteLine(decimal value);
對象表示裝箱/拆箱 –
但int,float,bool不能是大值 –