As far as I can see it is not possible.
But on the other hand it is not possible to create a function in a function in C# either; unless one tries, that is. These lambda functions behave like ordinary functions.
Proper structs are not possible according to this question on SO. The solution presented for structs doesn't declare a type but an anonymous one.
One can use Tuple<>
to get type safety but it is a bit hard to understand the content of myCustomer.Item1
.
Now neither functions nor structs are classes and I hope someone have invented a clever trick somewhere.
I would like something like:
public void MyMethod()
{
class MyClass
{
...
}
var x = new MyClass();
...
}