-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Description
Change CC0001 so that it only works on non primitives. Raise the new CC0105 for primitives.
There is a list of primitives types on MSDN of primitives from C#:
The primitive types are Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Char, Double, and Single.
Remarks:
- DateTime is not a primitive and should still be covered by
CC0001. - String is not a primitive and should still be covered by
CC0001. CC0105Should apply to both when the type is declared using an identifier name (System.Int32 i;) or using a predefined type (int i;).CC0105should followCC0001category and severity level (Style and Warning).- The code fix provider for
CC0001should updated to supportCC0105, but not other change should be made to it.
Just as a reference, this is @OsirisTerje original comment:
As it is now, the CC0001 rule, "Use 'var' instead of specifying the type name" applies to any type. It could be wise to separate this into two rules, or, if possible, have an option for it, so that one can have it apply to only non-primitive types. Resharper also have this as an option.
Reactions are currently unavailable