Namespaces

Earlier in this chapter, we introduced the term namespace. In general, all classes in .NET are divided into namespaces to prevent name conflicts. Thus, classes with the same name may reside under the different namespaces. For example, Samples.Car and Examples.Car are different classes with the same name. We may distinguish them by their namespace.

When writing a program, you may refer to classes or types with a fully qualified name, a name in which the namespace precedes the class name. You can specify the fully qualified name either by delimiting the namespace and class name with two colons or by placing the whole name (both namespace and class) in double quotes and delimiting with a dot.

 System::Console->WriteLine("Hello"); # Correct ...

Get Programming PERL in the .NET Environment 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.