扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:blog 2007年11月11日
关键字:
Customer myCustomer = new Customer("Zach", "Smith"); |
public Customer(string firstName, string lastName) : this() { this.FirstName = firstName; this.LastName = lastName; } public Customer() {} |
Customer myCustomer = new Customer{FirstName = "Zach", LastName = "Smith" }; |
public Customer() {} |
Car car = new Car(18, 10, 550); |
Car car = new Car { WheelDiameter = 18, WheelWidth = 10, Horsepower = 550 }; |
varmyType = new { Length = 79, Width = 30 }; |
private void Speed() { var cobra = new { Horsepower = 550, Torque = 570 }; } |
private void Speed() { var cobra = new { Horsepower = 550, Torque = 570 }; var mustang = new { Horsepower = 300, Torque = 300 }; mustang = cobra; //or you could say cobra = mustang } |
using System; using System.Query; using System.Collections.Generic; public class SampleClass { static void Main() { List<Customer> customers = GetCustomers(); //Write our query to retrieve customers who have more than // 10 orders. IEnumerable<Customer> queryResult = from customer in customers where customer.OrderCount > 10 orderbycustomer.ID select customer; } } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。