首页 > TAG信息列表 > 本质论

C#学习笔记(4):泛型

以《C#6.0本质论(Essential C# 6.0)》为基本,参考《深入解析C#(C# in Depth, 4th Edition)》、《C#图解教程(Illustrated C# 7, 5th Edition)》。圆括号内是本质论书中位置、方括号是个人补充 泛型的优点 泛型促进了类型安全(P314) 避免了装箱和开箱,提高了性能、减小了内存消耗(P314) 泛

分享一个Byte KB MB GB 单位转换方法 从《C#本质论第三版》

static public string FormatBytes(long bytes) { string[] magnitudes = new string[] { "GB", "MB", "KB", "Bytes" }; long max = (long)Math.Pow(1024, magnitudes.Length);