@@ -43,13 +43,16 @@ public CodeInspectionSetting GetSetting<TInspection>() where TInspection : IInsp
43
43
?? GetSetting ( typeof ( TInspection ) ) ;
44
44
}
45
45
46
- public CodeInspectionSetting GetSetting ( Type inspection )
46
+ public CodeInspectionSetting GetSetting ( Type inspectionType )
47
47
{
48
48
try
49
49
{
50
- var proto = Convert . ChangeType ( Activator . CreateInstance ( inspection ) , inspection ) ;
51
- var existing = CodeInspections . FirstOrDefault ( s => proto . GetType ( ) . ToString ( ) . Equals ( s . Name ) ) ;
52
- if ( existing != null ) return existing ;
50
+ var existing = CodeInspections . FirstOrDefault ( s => inspectionType . ToString ( ) . Equals ( s . Name ) ) ;
51
+ if ( existing != null )
52
+ {
53
+ return existing ;
54
+ }
55
+ var proto = Convert . ChangeType ( Activator . CreateInstance ( inspectionType ) , inspectionType ) ;
53
56
var setting = new CodeInspectionSetting ( proto as IInspectionModel ) ;
54
57
CodeInspections . Add ( setting ) ;
55
58
return setting ;
@@ -80,37 +83,15 @@ public class CodeInspectionSetting : IInspectionModel
80
83
[ XmlIgnore ]
81
84
public string Description
82
85
{
83
- get
84
- {
85
- if ( _description == null )
86
- {
87
- _description = InspectionsUI . ResourceManager . GetString ( Name + "Name" ) ;
88
- }
89
- return _description ;
90
- }
91
- set
92
- {
93
- _description = value ;
94
- }
86
+ get => _description ?? ( _description = InspectionsUI . ResourceManager . GetString ( Name + "Name" ) ) ;
87
+ set => _description = value ;
95
88
} // not serialized because culture-dependent
96
89
97
90
[ XmlIgnore ]
98
- public string LocalizedName
99
- {
100
- get
101
- {
102
- return InspectionsUI . ResourceManager . GetString ( Name + "Name" , CultureInfo . CurrentUICulture ) ;
103
- }
104
- } // not serialized because culture-dependent
91
+ public string LocalizedName => InspectionsUI . ResourceManager . GetString ( Name + "Name" , CultureInfo . CurrentUICulture ) ; // not serialized because culture-dependent
105
92
106
93
[ XmlIgnore ]
107
- public string AnnotationName
108
- {
109
- get
110
- {
111
- return Name . Replace ( "Inspection" , string . Empty ) ;
112
- }
113
- }
94
+ public string AnnotationName => Name . Replace ( "Inspection" , string . Empty ) ;
114
95
115
96
[ XmlIgnore ]
116
97
public CodeInspectionSeverity DefaultSeverity { get ; private set ; }
@@ -119,13 +100,7 @@ public string AnnotationName
119
100
public CodeInspectionSeverity Severity { get ; set ; }
120
101
121
102
[ XmlIgnore ]
122
- public string Meta
123
- {
124
- get
125
- {
126
- return InspectionsUI . ResourceManager . GetString ( Name + "Meta" , CultureInfo . CurrentUICulture ) ;
127
- }
128
- }
103
+ public string Meta => InspectionsUI . ResourceManager . GetString ( Name + "Meta" , CultureInfo . CurrentUICulture ) ;
129
104
130
105
[ XmlIgnore ]
131
106
// ReSharper disable once UnusedMember.Global; used in string literal to define collection groupings
@@ -134,7 +109,7 @@ public string Meta
134
109
[ XmlIgnore ]
135
110
public string SeverityLabel
136
111
{
137
- get { return InspectionsUI . ResourceManager . GetString ( "CodeInspectionSeverity_" + Severity , CultureInfo . CurrentUICulture ) ; }
112
+ get => InspectionsUI . ResourceManager . GetString ( "CodeInspectionSeverity_" + Severity , CultureInfo . CurrentUICulture ) ;
138
113
set
139
114
{
140
115
foreach ( var severity in Enum . GetValues ( typeof ( CodeInspectionSeverity ) ) )
0 commit comments