-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-Language DesignFeature RequestLanguage-C#Resolution-DuplicateThe described behavior is tracked in another issueThe described behavior is tracked in another issueVerified
Description
java supports local class declaration, e.g.
public void Method1(){
class Class1 {
}
}
This is super useful when a function logic is complex, and some data types are not used outside the function. Such local class just solves the problem.
Besides, C++ also supports that.
It is a pity that C# does not support that feature.
And I think this is just a syntax sugar, and does not involve the changes of CLR. So it is an easy feature.
In java, the local class is just treated as an inner class, e.g. MethodName$LocalClassName.
And C# can use the same strategy.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Language DesignFeature RequestLanguage-C#Resolution-DuplicateThe described behavior is tracked in another issueThe described behavior is tracked in another issueVerified