{"action":"created","issue":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1482","labels_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1482/labels{/name}","comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1482/comments","events_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1482/events","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1482","id":106648399,"number":1482,"title":"New rule proposal: Use default(T) for value types","user":{"login":"sharwell","id":1408396,"avatar_url":"https://avatars.githubusercontent.com/u/1408396?v=3","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels/needs%20discussion","name":"needs discussion","color":"f7c6c7"},{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels/new%20rule","name":"new rule","color":"207de5"},{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels/proposal","name":"proposal","color":"207de5"},{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels/readability","name":"readability","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-15T21:13:20Z","updated_at":"2015-09-16T19:23:43Z","closed_at":null,"body":"**Category:** Readability\r\n**Title:** Use `default(T)` to create default value type instances\r\n**Description:** A default instance of a value type `T` may be obtained by either `default(T)` or `new T()`. In these scenarios, the `default(T)` syntax should be used.\r\n\r\n**Rationale:** This is especially applicable for code using `ImmutableArray<T>` (a value type). Code which formerly used `List<T>` or `T[]` (both reference types) need to be very careful not to mistake `new ImmutableArray<T>()` for the same behavior. This syntax results in a default `ImmutableArray<T>` instance, whose behavior more closely resembles `null` than any non-null instance (especially in regards to exceptions being thrown). Similar behavior can be seen for `Nullable<T>`.\r\n\r\n:memo: This proposal only refers to the distinction between `default(T)` and `new T()`. Other default values, including `CancellationToken.None`, `0`, `0.0f`, `IntPtr.Zero`, and `RegexOptions.None`, would *not* produce a warning.\r\n\r\n:memo: This proposal was inspired by code observed in [dotnet/Roslyn#5180 (comment)](https://github.com/dotnet/roslyn/pull/5180#discussion_r39443514)."},"comment":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/comments/140857780","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1482#issuecomment-140857780","issue_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1482","id":140857780,"user":{"login":"sharwell","id":1408396,"avatar_url":"https://avatars.githubusercontent.com/u/1408396?v=3","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T19:23:43Z","updated_at":"2015-09-16T19:23:43Z","body":"@otac0n Does your :+1: mean you just retracted the :-1: vote, or are you adding a :+1: in favor of the proposal?"}}