Microsoft has adopted an "Open Source" policy on its products. With this, it has released in various media the codes of various products, such as the ASP.NET and the Entity Framework, for example.
In this article is explained how it happened and what is Open Source today. It is worth noting that something may have been added to the list since the date of the article, so it is worth checking the Github and see if there’s anything new.
It is worth mentioning in this answer the mono project. You can find more details about him in this answer.
The code you requested, specifically the method First()
, 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.
You can use a decompiler, here you can download a good and free.
– Marco Giovanni