payload: {"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/csharplang/issues/2942","repository_url":"https://api.github.com/repos/dotnet/csharplang","labels_url":"https://api.github.com/repos/dotnet/csharplang/issues/2942/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/csharplang/issues/2942/comments","events_url":"https://api.github.com/repos/dotnet/csharplang/issues/2942/events","html_url":"https://github.com/dotnet/csharplang/issues/2942","id":519524791,"node_id":"MDU6SXNzdWU1MTk1MjQ3OTE=","number":2942,"title":"Proposal: Overload for TryParse() to assign value of Type T if parsing fails","user":{"login":"asmarkis","id":7199750,"node_id":"MDQ6VXNlcjcxOTk3NTA=","avatar_url":"https://avatars3.githubusercontent.com/u/7199750?v=4","gravatar_id":"","url":"https://api.github.com/users/asmarkis","html_url":"https://github.com/asmarkis","followers_url":"https://api.github.com/users/asmarkis/followers","following_url":"https://api.github.com/users/asmarkis/following{/other_user}","gists_url":"https://api.github.com/users/asmarkis/gists{/gist_id}","starred_url":"https://api.github.com/users/asmarkis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmarkis/subscriptions","organizations_url":"https://api.github.com/users/asmarkis/orgs","repos_url":"https://api.github.com/users/asmarkis/repos","events_url":"https://api.github.com/users/asmarkis/events{/privacy}","received_events_url":"https://api.github.com/users/asmarkis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-11-07T21:31:47Z","updated_at":"2019-11-07T21:31:47Z","closed_at":null,"author_association":"NONE","body":"Hi. I was reading through another feature request for ternary operator without the else condition when working with TryParse, but it raises a concern on what should happen by default, especially when assigning variables. This brings me to propose an enhancement to TryParse that can save time in assignment if the parsing fails.\r\n\r\nTake this example:\r\n```\r\nint value;\r\nif (!int.TryParse(stringValue, out value))\r\nvalue = 42;\r\n```\r\n\r\nThis can be simplified currently as such:\r\n`int value = int.TryParse(stringValue, out value) ? value : 42;`\r\n\r\nBut my proposal would be the ability to handle this situation within a TryParse overload itself:\r\n`int.TryParse(stringValue, out int value, 42);`\r\n\r\nWhere `42` is the value assigned if parsing could not determine a value to assign. Essentially a default value overload:\r\n`bool T.TryParse(string s, out T result, T default)`\r\n\r\nIn many cases, I'm sure, models are created with default values within them to ensure good practices; in my case I am just using the code above to parse configuration strings and providing other methods with the parameters.\r\n\r\nInterested in what the experts think about this one 😃 \r\n"}}
other: {"actor":{"display_login":"asmarkis"}}