When to use var or IEnumerable to store query result in LINQ?
Answer / Mohd Kasim Khan
Use var when you don't need the specific type of the collection. The compiler will infer the correct type based on the query results. Use IEnumerable when you want to explicitly specify that the collection is an IEnumerable and can be iterated.
| Is This Answer Correct ? | 0 Yes | 0 No |
How LINQ is beneficial than Stored Procedures?
What are conversion operators?
What are the three main components of linq or language integrated query?
Explain why select clause comes after from clause in linq?
What is a linq expression?
Why is linq required?
Does entity framework use linq?
What are linq extension methods?
How much does a reveal linq cost?
What is data context class? Explain its role?
What is difference between linq and entity framework?
Why do we use linq?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)