Kind of an interesting mental exercise. Say you wanted to enumerate all the classes in any particular namespace. Unfortunately there doesn't appear to be a way to say, "Get all classes in a namespace" using reflection, so you kind of have to roll your own implementation. But, this is how I did it....
namespace TestingGroundsCSharpConsole
{
class Program
{
static void Main(string[] args)
{
Assembly a = Assembly.GetExecutingAssembly();
List<String> namespaces = new List<string>();
foreach (Type t in a.GetTypes())
{
if (t.Namespace == "TestingGroundsCSharpConsole")
namespaces.Add(t.Name);
}
foreach (String s in namespaces)
Console.WriteLine(s);
Console.ReadLine();
return;
}
}
class Class1
{
private Int32 _myInt;
}
class Class2
{
private Int32 _myotherInt;
}
}
....the output is
Program
Class1
Class2