<?xml version="1.0"?>
<clause number="16.5" title="Type declarations">
  <paragraph>A <non_terminal where="16.5">type-declaration</non_terminal> is a <non_terminal where="17.1">class-declaration</non_terminal> (<hyperlink>17.1</hyperlink>), a <non_terminal where="18.1">struct-declaration</non_terminal> (<hyperlink>18.1</hyperlink>), an <non_terminal where="20.1">interface-declaration</non_terminal> (<hyperlink>20.1</hyperlink>), an <non_terminal where="21.1">enum-declaration</non_terminal> (<hyperlink>21.1</hyperlink>), or a <non_terminal where="22.1">delegate-declaration</non_terminal> (<hyperlink>22.1</hyperlink>). <grammar_production><name><non_terminal where="16.5">type-declaration</non_terminal></name> : <rhs><non_terminal where="17.1">class-declaration</non_terminal></rhs><rhs><non_terminal where="18.1">struct-declaration</non_terminal></rhs><rhs><non_terminal where="20.1">interface-declaration</non_terminal></rhs><rhs><non_terminal where="21.1">enum-declaration</non_terminal></rhs><rhs><non_terminal where="22.1">delegate-declaration</non_terminal></rhs></grammar_production></paragraph>
  <paragraph>A <non_terminal where="16.5">type-declaration</non_terminal> can occur as a top-level declaration in a compilation unit or as a member declaration within a namespace, class, or struct. </paragraph>
  <paragraph>When a type declaration for a type T occurs as a top-level declaration in a compilation unit, the fully qualified name of the newly declared type is simply T. When a type declaration for a type T occurs within a namespace, class, or struct, the fully qualified name of the newly declared type is N.T, where N is the fully qualified name of the containing namespace, class, or struct. </paragraph>
  <paragraph>A type declared within a class or struct is called a nested type (<hyperlink>17.2.6</hyperlink>). </paragraph>
  <paragraph>The permitted access modifiers and the default access for a type declaration depend on the context in which the declaration takes place (<hyperlink>10.5.1</hyperlink>): <list><list_item> Types declared in compilation units or namespaces can have public or internal access. The default is internal access. </list_item><list_item> Types declared in classes can have public, protected internal, protected, internal, or private access. The default is private access. </list_item><list_item> Types declared in structs can have public, internal, or private access. The default is private access. <table_line/>
</list_item></list></paragraph>
</clause>
