{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/8004","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/8004/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/8004/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/8004/events","html_url":"https://github.com/dotnet/roslyn/issues/8004","id":127013066,"number":8004,"title":"Allow using on non disposable and null skip using","user":{"login":"Thaina","id":1042507,"avatar_url":"https://avatars.githubusercontent.com/u/1042507?v=3","gravatar_id":"","url":"https://api.github.com/users/Thaina","html_url":"https://github.com/Thaina","followers_url":"https://api.github.com/users/Thaina/followers","following_url":"https://api.github.com/users/Thaina/following{/other_user}","gists_url":"https://api.github.com/users/Thaina/gists{/gist_id}","starred_url":"https://api.github.com/users/Thaina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Thaina/subscriptions","organizations_url":"https://api.github.com/users/Thaina/orgs","repos_url":"https://api.github.com/users/Thaina/repos","events_url":"https://api.github.com/users/Thaina/events{/privacy}","received_events_url":"https://api.github.com/users/Thaina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-16T09:36:44Z","updated_at":"2016-01-16T14:46:54Z","closed_at":null,"body":"From pattern matching proposal https://github.com/dotnet/roslyn/blob/future/docs/features/patterns.md\r\n\r\nI don't like syntax `if (expr is Type v) { // code using v }` It not so readable\r\n\r\nSo I want to propose using anything for constraint scope.\r\n\r\n```\r\nusing(var text = \"Hello\")\r\n{\r\n   Console.WriteLine(text); //// Hello\r\n}\r\n\r\nConsole.WriteLine(text); //// Compiler error, no text available here\r\n```\r\n\r\nThen I want to propose syntax using?\r\nWhich will work like if. If the variable inside that using is null then it will skip all the thing inside\r\n\r\n```\r\nstring text = null;\r\nusing?(var t = text)\r\n{\r\n   Console.WriteLine(t); //// Will not come in here\r\n}\r\n\r\nConsole.WriteLine(t); //// Compiler error, no t available here\r\n\r\n```\r\n\r\nps. Alternatively I would like to let we could use operator ?? after declaration and it will both add variable to scope and return true/false\r\nI mean like this `if ((var v = expr as Type)??) { // code using v }` Maybe better"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/172213100","html_url":"https://github.com/dotnet/roslyn/issues/8004#issuecomment-172213100","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/8004","id":172213100,"user":{"login":"alrz","id":3105979,"avatar_url":"https://avatars.githubusercontent.com/u/3105979?v=3","gravatar_id":"","url":"https://api.github.com/users/alrz","html_url":"https://github.com/alrz","followers_url":"https://api.github.com/users/alrz/followers","following_url":"https://api.github.com/users/alrz/following{/other_user}","gists_url":"https://api.github.com/users/alrz/gists{/gist_id}","starred_url":"https://api.github.com/users/alrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alrz/subscriptions","organizations_url":"https://api.github.com/users/alrz/orgs","repos_url":"https://api.github.com/users/alrz/repos","events_url":"https://api.github.com/users/alrz/events{/privacy}","received_events_url":"https://api.github.com/users/alrz/received_events","type":"User","site_admin":false},"created_at":"2016-01-16T14:46:54Z","updated_at":"2016-01-16T14:46:54Z","body":"@Thaina Actually, in this case, it's a *type check* and also you can use any *pattern* that mentioned in the spec draft. I suggest you to read it once again."}}