Include

  • Thread starter Thread starter Manish Agarwal
  • Start date Start date
M

Manish Agarwal

One common use of C++ #include I am looking for including file with using
statements. Typically in a big C# program I have to write around 15-20 using
statements on the top every file.

like-
using System;
using System.Windows.Forms;
using System.Drawing;
using blah blah blah

If I put these using statement in a single C# file and include in every C#
file. Life will be cool. Same problem with Java. Any alternate to this
problem or reason why we don't have this in C#?
 
Manish Agarwal said:
One common use of C++ #include I am looking for including file with using
statements. Typically in a big C# program I have to write around 15-20 using
statements on the top every file.

like-
using System;
using System.Windows.Forms;
using System.Drawing;
using blah blah blah

If I put these using statement in a single C# file and include in every C#
file. Life will be cool. Same problem with Java. Any alternate to this
problem or reason why we don't have this in C#?

If you're having to put 15-20 using statements at the top of every
file, chances are your classes are *way* too big. Very, very
occasionally I'll end up with about 10, but pretty much never more than
that.

I would suggest making your classes do less (but having more of them) -
that will make your code more maintainable and get rid of this problem,
both in one fell swoop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top