Skip to content
- consistent model for working with data from various kinds of sources and formats (XML, SQL, ADO.NET, Datasets, .NET collections etc)
- 3 stages of working with LINQ:
- obtain data source
- create the query
- execute the query
- data sources implements
IEnumerable<>
and are called queryable types
IQueryable<>
interface inherits from IEnumerable<>
- generally it is better to use LINQ via
IQueryable<>
which produces deferred query
instead of producing result immediately - queries can be executed multiple times
- queries can be forced immediate execution via
Count()
, Max()
, ToList()
or ToArray()
etc. - LINQ to DB libraries (like EntityFramework) usually are implemented via
Expression Trees