Did you know...? (using syntax in C#)
Most of the C# files I read are structured similarly to the following...
/*
* My fancy header du jour.
*/
using System;
using System.Data;
using Other.Stuff;
namespace My.Namespace.Is.Better.Than.Yours
{
// Code goes here.
}
Personally, I've adopted the following convention. Note where the using statements were moved to.
/*
* Yes, I have a fancy header, as well.
*/
namespace My.Namespace.Is.Better.Than.Yours
{
using System;
using System.Data;
using Other.Stuff;
// Code goes here.
}
This limits the scope of the using statements to the enclosing curly braces. Which means that I can get my 10 file project, run a copy command from a console, and get a neat, single-file project, that ends up looking like this:
/* The first file */
namespace Whatever
{
using Foo;
// Code
}
/* The second file */
namespace BlahBlahBlah
{
using Something.That.Might.Otherwise.Conflict;
// Code
}
...
And, for those of you who don't quite remember how the syntax was for the copy command in "append stuff mode", here y'go.
copy file1.cs + file2.cs + file3.cs MyReallyLargeFile.cs
This posting is provided "AS IS" with no warranties, and confers no rights.