{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/3759","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/3759/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/3759/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/3759/events","html_url":"https://github.com/dotnet/roslyn/issues/3759","id":92206031,"number":3759,"title":"Proposal: NameOf to have optional parameters.","user":{"login":"AdamSpeight2008","id":900107,"avatar_url":"https://avatars.githubusercontent.com/u/900107?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamSpeight2008","html_url":"https://github.com/AdamSpeight2008","followers_url":"https://api.github.com/users/AdamSpeight2008/followers","following_url":"https://api.github.com/users/AdamSpeight2008/following{/other_user}","gists_url":"https://api.github.com/users/AdamSpeight2008/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamSpeight2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamSpeight2008/subscriptions","organizations_url":"https://api.github.com/users/AdamSpeight2008/orgs","repos_url":"https://api.github.com/users/AdamSpeight2008/repos","events_url":"https://api.github.com/users/AdamSpeight2008/events{/privacy}","received_events_url":"https://api.github.com/users/AdamSpeight2008/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-30T21:30:21Z","updated_at":"2015-07-01T05:23:57Z","closed_at":null,"body":"**Proposal: NameOf to have optional parameters.**\r\n\r\nCurrently.\r\n`nameof(Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider)` = `\"CodeFixProvider\"`\r\n(See #3708)\r\n\r\nTo fix this I propose that we should extend **NameOf** with optional parameters. ` , NameOfOptions:=   )`\r\n\r\n**NameOfOption Enum**\r\n```vb\r\nEnum NameOfOption As Integer\r\n\r\n  [default] = 0\r\n  fullname  = 1\r\n\r\nEnd Enum\r\n```\r\n**Api signature**\r\n``` vb\r\nNameOf(  obj As Object, Optional NameOfOptions As NameOfOption = Nothing ) As String\r\n```\r\n\r\n**Example**\r\n```\r\nnameof(Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider, NameOfOptions:= NameOfOption.FullName )\r\n```\r\nThis would then provide the fully-qualified name.\r\n\r\nIt provides a compile-time solution, to what (I believe) requires the use of reflection, or explicitly stating the full name as a string literal. Hence introducing a potential bug if it changes namespace or name.\r\n\r\nDoes not break existing usage because the parameter is optional."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/117438737","html_url":"https://github.com/dotnet/roslyn/issues/3759#issuecomment-117438737","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/3759","id":117438737,"user":{"login":"leppie","id":127666,"avatar_url":"https://avatars.githubusercontent.com/u/127666?v=3","gravatar_id":"","url":"https://api.github.com/users/leppie","html_url":"https://github.com/leppie","followers_url":"https://api.github.com/users/leppie/followers","following_url":"https://api.github.com/users/leppie/following{/other_user}","gists_url":"https://api.github.com/users/leppie/gists{/gist_id}","starred_url":"https://api.github.com/users/leppie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leppie/subscriptions","organizations_url":"https://api.github.com/users/leppie/orgs","repos_url":"https://api.github.com/users/leppie/repos","events_url":"https://api.github.com/users/leppie/events{/privacy}","received_events_url":"https://api.github.com/users/leppie/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T05:23:57Z","updated_at":"2015-07-01T05:23:57Z","body":"`nameof` is a compile time construct, it has no API.\r\n\r\nA better solution would be to use pragmas to control the output/options."}}