Learning Type Access Modifiers Basics !!!

When I started developing my module, I had an interface IParamCountBasedAlgo declared as a nested type in a class AlgorithmOneExecutor, declared as follows:-

namespace DataStructuresAndAlgo
{
partial class AlgorithmOneExecutor
{
private interface IParamCountBasedAlgo
{
void Validate();
void Execute();
}
}
}

There were other concrete nested types inside AlgorithmOneExecutor that implemented IParamCountBasedAlgo. But later, other types nested in other than AlgorithmOneExecutor emerged that required to implement IParamCountBasedAlgo. So I moved IParamCountBasedAlgo from a nested type to a direct type under the namespace DataStructuresAndAlgo, as declared below:-

<pre>namespace DataStructuresAndAlgo<br />{<br /> private interface IParamCountBasedAlgo<br /> {<br />   void Validate();<br />   void Execute();<br /> }<br />}<br /></pre>

<p>
  </span>And the compiler spat an error &#8220;<span style="font-family:Courier New,Courier,Monospace;">Namespace elements cannot be explicitly declared as private, protected, or protected internal</span>&#8220;. Then a simple research gave me an insight that types directly under namespace can be declared either public or internal only, and the default is internal. Seems reasonable cuz if declared private, it gives an ambiguous look that it cannot accessed or created and protected seems rather very unrelated. Hence either public or internal only.
</p>

<p>
  A subtle point to note is that not all access modifiers are applicable for all types and at all declaration levels. To learn the basics of type access modifiers, visit <a href="http://msdn2.microsoft.com/en-us/library/ms173121.aspx">http://msdn2.microsoft.com/en-us/library/ms173121.aspx</a>
</p></div>