Using the .NET Framework Class Library (Visual C#)

Most Visual C# development projects use the .NET Framework Class Library extensively for everything from file system access and string manipulation to Windows Forms and ASP.NET user interface controls.

The class library is organized into namespaces, each of which contains a set of related classes and structs. For example, the System.Drawing namespace contains numerous types that represent fonts, pens, lines, shapes, colors, and so on.

using Directives and References

Before you can use the classes in a given namespace in a C# program, you must add a using directive for that namespace to your C# source file. In some cases, you must also add a reference to the DLL that contains the namespace; Visual C# automatically adds references to the most commonly used class library DLLs. You can see which references have been added in Solution Explorer under the References node. For more information, see Creating a Project (Visual C#).

After you have added the using directive for a namespace, you can create instances of its types, call methods, and respond to events just as if they were declared in your own source code. In the Visual C# code editor, you can also put the insertion point over a type or member name, and press F1 to see the Help documentation. You can also use the Object Browser tool and Metadata As Source feature to see type information on .NET Framework classes and structs. For more information, see Modeling and Analyzing Code (Visual C#).

For More Information

C# and .NET Programming in Learning C# 3.0: Master the fundamentals of C# 3.0

See Also

Other Resources

Writing Applications with Visual C#

Using the Visual C# IDE