这篇文章主要通过演示类在不同发展中的不通过定义方法,来向读者表述它们之间的区别和联系。在C#1时代,我们喜欢这样定义类:public class Product { private string _name; public string Name { ge ...
这篇文章主要通过演示类在不同发展中的不通过定义方法,来向读者表述它们之间的区别和联系。
在C#1时代,我们喜欢这样定义类:
public class Product { private get='_blank'>string _name; public string Name { get { return _name; } } private decimal _price; public decimal Price { get { return _price; } } public Product(string name, decimal price) { this._name = name; this._price = price; } public static ArrayList GetArrayList() { ArrayList list = new ArrayList(); list.Add(new Product("WindowsPhone", 10m)); list.Add(new Product("Apple", 10m)); list.Add(new Product("Android", 10m)); return list; } public override string ToString() { return String.Format("{0}--{1}", _name, _price); } }
原标题:C#特性之数据类型
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。