Yes, you can declare a class inside a class , and they are called inner classes
public class Foo { public class Bar { } }
and how can you create an instance
Foo foo = new Foo(); Foo.Bar bar = new Foo.Bar();
And within the method you can create an anonymous type object
void Fn() { var anonymous= new { Name="name" , ID=2 }; Console.WriteLine(anonymous.Name+" "+anonymous.ID); }
Sleiman jneidi
source share