{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/csharplang/issues/1993","repository_url":"https://api.github.com/repos/dotnet/csharplang","labels_url":"https://api.github.com/repos/dotnet/csharplang/issues/1993/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/csharplang/issues/1993/comments","events_url":"https://api.github.com/repos/dotnet/csharplang/issues/1993/events","html_url":"https://github.com/dotnet/csharplang/issues/1993","id":379438056,"node_id":"MDU6SXNzdWUzNzk0MzgwNTY=","number":1993,"title":"Feature request: C# 7.3 enum generic constraint not being able to cast to integer","user":{"login":"alexdrl","id":26382633,"node_id":"MDQ6VXNlcjI2MzgyNjMz","avatar_url":"https://avatars2.githubusercontent.com/u/26382633?v=4","gravatar_id":"","url":"https://api.github.com/users/alexdrl","html_url":"https://github.com/alexdrl","followers_url":"https://api.github.com/users/alexdrl/followers","following_url":"https://api.github.com/users/alexdrl/following{/other_user}","gists_url":"https://api.github.com/users/alexdrl/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdrl/subscriptions","organizations_url":"https://api.github.com/users/alexdrl/orgs","repos_url":"https://api.github.com/users/alexdrl/repos","events_url":"https://api.github.com/users/alexdrl/events{/privacy}","received_events_url":"https://api.github.com/users/alexdrl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":30,"created_at":"2018-11-10T16:45:41Z","updated_at":"2018-11-15T11:45:06Z","closed_at":null,"author_association":"NONE","body":"I am not being able to cast a generic method restricted type parameter to work like I supposed it worked.\r\n\r\n```cs\r\npublic void DoSomething<T>(List<T> list)\r\n    where T : Enum\r\n{\r\n    T first = list.FirstOrDefault();\r\n    int value = (int) first;\r\n}\r\n```\r\n\r\nI am missing something?\r\n\r\n**UPDATE:**\r\nWhat about something like:\r\n```cs\r\npublic void DoSomething<T>(List<T> list)\r\n    where T : Enum, int\r\n{\r\n    T first = list.FirstOrDefault();\r\n    int value = (int) first;\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/csharplang/issues/comments/439013081","html_url":"https://github.com/dotnet/csharplang/issues/1993#issuecomment-439013081","issue_url":"https://api.github.com/repos/dotnet/csharplang/issues/1993","id":439013081,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTAxMzA4MQ==","user":{"login":"mikernet","id":1700111,"node_id":"MDQ6VXNlcjE3MDAxMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/1700111?v=4","gravatar_id":"","url":"https://api.github.com/users/mikernet","html_url":"https://github.com/mikernet","followers_url":"https://api.github.com/users/mikernet/followers","following_url":"https://api.github.com/users/mikernet/following{/other_user}","gists_url":"https://api.github.com/users/mikernet/gists{/gist_id}","starred_url":"https://api.github.com/users/mikernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikernet/subscriptions","organizations_url":"https://api.github.com/users/mikernet/orgs","repos_url":"https://api.github.com/users/mikernet/repos","events_url":"https://api.github.com/users/mikernet/events{/privacy}","received_events_url":"https://api.github.com/users/mikernet/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T11:45:06Z","updated_at":"2018-11-15T11:45:06Z","author_association":"NONE","body":"There are probably a couple places I would use this if it was available since a compile time error is much nicer than a runtime error if you require an enum of a certain underlying type but that's such a niche situation that I can't imagine this will get a lot of priority. "}}
{"actor":{"display_login":"mikernet"}}