Nilesh Shah
In SQL queries 'Select' comes first, then comes 'From', but in LINQ, we have to write 'From' fist and 'Select' later. Why is it so?
By Nilesh Shah in LINQ on Dec 07 2016
  • Umesh Dhital
    Dec, 2017 10

    Because in SQL server we know that we are querying on existing sql data source(a table or view) but in LINQ , we dont know upfront which data source we are writing a query, it might be an object,sql data source or xml document. So, we need to specify the source we are querying first. Also, specifying the source first, the visual studio can provide the intellisense to the following 'select' statment.

    • 5
  • Nilesh Shah
    Dec, 2016 7

    LINQ is based on C# which is a declarative language, means whenever you want to use any variable name, it must have been already been declared beforehand. In LINQ queries, when you write "From" first - it declares the variable whoch can later be used in "Select" statement.

    • 4


Most Popular Job Functions


MOST LIKED QUESTIONS