Saturday, June 14, 2008

Order of Usings in C#

Something strange with Visual Studio 2008. I was trying to use LINQ in a class in an Excel Addin that I was writing and setup the using statements as follows:

using System;
using System.Collections.Generic;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Linq;

Would not compile and no intellisense.

I re-arranged the usings like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;

It compile and I received intellisense.

Out of curiosity I changed the usings back to how they originally were with the System.Linq at the end and this time VS2008 compiled it.

A bit weired - not sure what's happening here...

No comments:

Post a Comment