1 out of 1 rated this helpful - Rate this topic

10.2.6 Nested types

Visual Studio .NET 2003

A type declared within a class or struct is called a nested type. A type that is declared within a compilation unit or namespace is called a non-nested type.

In the example

using System;
class A
{
   class B
   {
      static void F() {
         Console.WriteLine("A.B.F");
      }
   }
}

class B is a nested type because it is declared within class A, and class A is a non-nested type because it is declared within a compilation unit.

Did you find this helpful?
(1500 characters remaining)