The general structure of a C# program is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| namespace MyNamespace { class MyClass { } struct AStruct { } interface IAnInterface { } delegate int ADelegateType(); enum AnEnum { } class Program { static void Main( string [] args) { return ; } } } |
The most common convention is to store each class or interface in a different source code file (e.g. MyClass.cs andIAnInterface.cs), but you can store multiple objects in a single source file, or even split classes up across multiple files.