Component-Based Features

Up to this point, we've focused on programs and even program fragments in introducing the concepts of the language. However, C# has several features that enable building component-based applications: namespaces, assemblies, and attributes.

Namespaces and Assemblies

Namespaces provide a logical organizational system, both internally within the program and externally to other programs. Consider the following example:

namespace Que.ByExample
{
    class Book
    { ...}

Because namespaces may be nested, the preceding example is functionally equivalent to

namespace Que
{
    namespace ByExample
    {
        class Book
        { ...}
    }
}

In either case, we can reference the Book class via its fully qualified namespace:

Que.ByExample.Book

We can avoid ...

Get ASP.NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.