Microsoft has adopted an "Open Source" policy on its products. As a result, it has released various product codes, such as ASP.NET , and the Entity Framework , for example.
This article explains how it happened and what is Open Source today. It's worth mentioning that something may have been added to the list since the date of the article, so check out the GitHub and see if there's anything new.
Note in this answer the mono project . You can find more details about it in this answer .
The code you requested, specifically the First()
method, can be seen below:
public static TSource First<TSource>(this IQueryable<TSource> source) {
if (source == null)
throw Error.ArgumentNull("source");
return source.Provider.Execute<TSource>(
Expression.Call(
null,
GetMethodInfo(Queryable.First, source),
new Expression[] { source.Expression }
));
}
public static TSource First<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate) {
if (source == null)
throw Error.ArgumentNull("source");
if (predicate == null)
throw Error.ArgumentNull("predicate");
return source.Provider.Execute<TSource>(
Expression.Call(
null,
GetMethodInfo(Queryable.First, source, predicate),
new Expression[] { source.Expression, Expression.Quote(predicate) }
));
}
Link to the original code