c# - Anonymous types query or normal query in LINQ -
var emps = x in db where x.id = 100 select x; Var emp1 = x1 in db where x1.id = 100 select new {x};
What is the difference between these two questions?
If we use anonymous-types then what performance will increase or what will be the other differences?
There is a big difference between those two questions first, the collection of its entity, the second name is an unknown-type return The collection contains a member called 'x' which contains your unit.
Access to ampses:
emps first (). SomeMember
access to emp1:
emp1.First (). X.SomeMember
The first path is true and natural, the second is strange and not in my opinion what exactly do you want
Apart from this, it is also not correct That using an anonymous type here will increase the performance, the object represented by the object is in any way, but at this time you are getting it in less favorable form.
Comments
Post a Comment