{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/280","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/280/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/280/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/280/events","html_url":"https://github.com/dotnet/roslyn/issues/280","id":56802878,"number":280,"title":"[Proposal] Local class declaration","user":{"login":"zgxnet","id":9656617,"avatar_url":"https://avatars.githubusercontent.com/u/9656617?v=3","gravatar_id":"","url":"https://api.github.com/users/zgxnet","html_url":"https://github.com/zgxnet","followers_url":"https://api.github.com/users/zgxnet/followers","following_url":"https://api.github.com/users/zgxnet/following{/other_user}","gists_url":"https://api.github.com/users/zgxnet/gists{/gist_id}","starred_url":"https://api.github.com/users/zgxnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zgxnet/subscriptions","organizations_url":"https://api.github.com/users/zgxnet/orgs","repos_url":"https://api.github.com/users/zgxnet/repos","events_url":"https://api.github.com/users/zgxnet/events{/privacy}","received_events_url":"https://api.github.com/users/zgxnet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-06T11:49:48Z","updated_at":"2015-02-06T13:52:33Z","closed_at":null,"body":"java supports local class declaration, e.g. \r\npublic void Method1(){ \r\n    class Class1 { \r\n    }  \r\n} \r\nThis 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. \r\nBesides, C++ also supports that. \r\n\r\nIt is a pity that C# does not support that feature. \r\nAnd I think this is just a syntax sugar, and does not involve the changes of CLR. So it is an easy feature. \r\n\r\nIn java, the local class is just treated as an inner class, e.g. MethodName$LocalClassName. \r\nAnd C# can use the same strategy."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/73238955","html_url":"https://github.com/dotnet/roslyn/issues/280#issuecomment-73238955","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/280","id":73238955,"user":{"login":"mirhagk","id":1240903,"avatar_url":"https://avatars.githubusercontent.com/u/1240903?v=3","gravatar_id":"","url":"https://api.github.com/users/mirhagk","html_url":"https://github.com/mirhagk","followers_url":"https://api.github.com/users/mirhagk/followers","following_url":"https://api.github.com/users/mirhagk/following{/other_user}","gists_url":"https://api.github.com/users/mirhagk/gists{/gist_id}","starred_url":"https://api.github.com/users/mirhagk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirhagk/subscriptions","organizations_url":"https://api.github.com/users/mirhagk/orgs","repos_url":"https://api.github.com/users/mirhagk/repos","events_url":"https://api.github.com/users/mirhagk/events{/privacy}","received_events_url":"https://api.github.com/users/mirhagk/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T13:52:33Z","updated_at":"2015-02-06T13:52:33Z","body":"C# does support anonymous local class delcarations, which I would think solves any of the use cases a local class would solve. Intellisense does already pick up the member names, and it is statically typed, and assignment between objects of the same type work, so this only gives you the chance to define constructors (methods could already be assigned with lambdas) and that would not be appropriate for a locally declared class anyways.\r\n\r\nI can't see any use case that anonymous classes don't solve that this local class declaration does solve."}}