Search code examples
c#visual-studiousing-directives

What does it mean if a using directive is light blue in Visual Studio?


This is the code. I've tried rewriting it in a new program but it's the same problem as soon as I create a class the "using system" and the others appear in light blue as well as attributes.

class Book[][1]

class program


Solution

  • It means you can remove them from the file. Visual Studio includes some using directives automatically when you create a class, because they're so frequently used.

    For instance,

    • the System library includes types like String, Int32, DateTime, tons of exceptions like IndexOutOfRangeException, FormatException, etc.
    • the System.Collections.Generic library includes List<T>, Dictionary<TKey, TValue>, etc, and nearly every program will use a collection of some sort.
    • the System.Linq library is self-explanatory; again, nearly every program will use LINQ.

    But if you don't use anything in them, Visual Studio greys them out so you know they're unused.

    If you don't need them, you can delete them.