如题,“扩展方法where方法查询不到数据,不会抛异常,也不是返回的null”,示例代码如下:

Product类:

 public class Product
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private double price;

        public double Price
        {
            get { return price; }
            set { price = value; }
        }

        public override string ToString()
        {
            return string.Format("{0}:{1}", Name, Price);
        }
    }
View Code

相关文章: