匿名类型转实体类

调用 Select的时候,不 new 匿名类,new 所需要的泛型就好

例如:List<T> Info = (from tab in db.TableName
                                                 select new T
                                                 {
                                                      tab .Id,
                                                     tab .Name,
                                                      tab .lockNum
                                                 }).ToList();

猜你喜欢

转载自blog.csdn.net/cy520ta/article/details/84997464
今日推荐