Monday, January 6, 2014

Don’t forget to import the System.Linq namespace!!


I was recently working within an ASP.NET User Control’s code behind class file, when I noticed that while returning the result of a LINQ query from a method, none of the LINQ Extension methods were available!
In addition, because LINQ is a set of extension methods, Visual Studio will NEVER warn you to tell you that this namespace is missing!

Instead, you will simply get the following set of methods available from within Visual Studio when attempting to apply additional filter queries on a LINQ expression:


However, once you add the System.Linq namespace to the top of the class file, you will once again be able to view the familiar set of LINQ Extension methods:

 

No comments:

Post a Comment