I was just wondering if there was a way in C# to import (use) everything inside a namespace like there is in java with the wildcard character.
import java.awt.*;
I was just wondering if there was a way in C# to import (use) everything inside a namespace like there is in java with the wildcard character.
import java.awt.*;
That's what the normal using directive does. For instance:
using System;
means you can use Console, Guid, Int32 etc without qualification. The closest equivalent to the single import in Java is:
using Console = System.Console;
(etc)
but that's not used very often.
No, there is not a way to do something like:
using System.Windows.*;
I think the intent is to ensure that names are as clearly qualified as possible, and including something like this would potentially introduce more name collisions. Also, a "using" directive only changes how names are resolved... it does not cause additional assemblies (those that contain the classes of that namespace) to get loaded.