首页 > Windows开发 > 详细

C#对象初始或器-Chapter3 P38

时间:2015-10-22 14:11:24      阅读:299      评论:0      收藏:0      [点我收藏+]

 

 

 

  protected string GetMessage()
        {
            //如何构造和初始化泛型集合库中的一个数组和两个类。
            Product myProduct = new Product{ProductID=100,Name="Kayak",Description ="A boat for one person",Price=275M,Category="Watersports"};
            return String.Format("Category:{0}", myProduct.Category);
            string[] stringArray = { "apple", "orange", "plum" };
            List<int> intList = new List<int> { 10, 20, 30, 40 };
            Dictionary<string, int> myDict = new Dictionary<string, int> { { "apple", 10 }, { "orange", 20 }, { "plum", 30 } };
            return String.Format("fruit:{0}", (object)stringArray[1]);
        }

 

C#对象初始或器-Chapter3 P38

原文:http://www.cnblogs.com/CandiceW/p/4900580.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!