Lucas Lucas - 3 days ago 6
C# Question

C# equivalent to wildcard imports in Java

Is there a way in C# to import everything inside a namespace like there is in Java with the wildcard character?

import java.awt.*;

Answer

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.

Comments