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]); }
时间: 2024-10-13 07:14:50