# Type definitions in top-level statements

 C# does not allow types definitions in the top if we use top-level statements. Types must be moved towards the end of our code:

::::{grid} 2
:::{grid-item-card} ❌ `enum` not allowed as follows:
```cs
internal enum Color
{
    Red,
    Yellow,
    Green
}

Color agent = Color.Red, human = Color.Green;

Console.WriteLine($"agent: {agent}");
Console.WriteLine($"human: {human}");
```
:::
:::{grid-item-card} ✅ Ok:
```cs
Color agent = Color.Red, human = Color.Green;

Console.WriteLine($"agent: {agent}");
Console.WriteLine($"human: {human}");

internal enum Color
{
    Red,
    Yellow,
    Green
}
```
:::
::::

This is probably because:
- types cannot be nested in methods
- the compiler requires a clear separation between `Main` code and other code.

The compiler wraps top-level statements as follows:

```cs
namespace ConsoleApp1;

internal class Program
{
    private static void Main(string[] args)
    {
        Color agent = Color.Red, human = Color.Green;

        Console.WriteLine($"agent: {agent}");
        Console.WriteLine($"human: {human}");
    }
}

internal enum Color
{
    Red,
    Yellow,
    Green
}
```