扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
public class Student{ public string firstName; public string lastName; } |
var student1 = new Student{firstName = "Bruce", lastName = "Willis"}; |
List<string> names = new List<string> { "Alice", "Bob", "Chris" }; |
using System; using System.Collections.Generic; using System.Text; using System.Query; using System.Xml.XLinq; using System.Data.DLinq; namespace CollectionInitializer { class Program { public class MyClass { public string nameofClass; public List<string> studentNames = new List<string>(); } static void Main(string[] args) { var classes = new List<MyClass> { new MyClass { nameofClass = "Science", studentNames = {"Laura", "George"} }, new MyClass { nameofClass = "Commerce", studentNames = {"Bill", "Hillary"} } }; } } } |
C:\Program Files\LINQ Preview\Bin\Csc.exe /reference:"C:\Program Files\LINQ Preview\Bin\System.Data.DLinq.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:"C:\Program Files\LINQ Preview\Bin\System.Query.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\LINQ Preview\Bin\System.Xml.XLinq.dll" Program.cs |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者