Winify – Diff between revs 25 and 28

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 25 Rev 28
1 /* MIT License 1 /* MIT License
2   2  
3 Copyright (c) 2016 JetBrains http://www.jetbrains.com 3 Copyright (c) 2016 JetBrains http://www.jetbrains.com
4   4  
5 Permission is hereby granted, free of charge, to any person obtaining a copy 5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal 6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights 7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is 9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions: 10 furnished to do so, subject to the following conditions:
11   11  
12 The above copyright notice and this permission notice shall be included in all 12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software. 13 copies or substantial portions of the Software.
14   14  
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE. */ 21 SOFTWARE. */
22   22  
23 using System; 23 using System;
24   24  
25 // ReSharper disable InheritdocConsiderUsage 25 // ReSharper disable InheritdocConsiderUsage
26   26  
27 #pragma warning disable 1591 27 #pragma warning disable 1591
28 // ReSharper disable UnusedMember.Global 28 // ReSharper disable UnusedMember.Global
29 // ReSharper disable MemberCanBePrivate.Global 29 // ReSharper disable MemberCanBePrivate.Global
30 // ReSharper disable UnusedAutoPropertyAccessor.Global 30 // ReSharper disable UnusedAutoPropertyAccessor.Global
31 // ReSharper disable IntroduceOptionalParameters.Global 31 // ReSharper disable IntroduceOptionalParameters.Global
32 // ReSharper disable MemberCanBeProtected.Global 32 // ReSharper disable MemberCanBeProtected.Global
33 // ReSharper disable InconsistentNaming 33 // ReSharper disable InconsistentNaming
34   34  
35 namespace Servers.Properties 35 namespace Servers.Properties
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Indicates that the value of the marked element could be <c>null</c> sometimes, 38 /// Indicates that the value of the marked element could be <c>null</c> sometimes,
39 /// so checking for <c>null</c> is required before its usage. 39 /// so checking for <c>null</c> is required before its usage.
40 /// </summary> 40 /// </summary>
41 /// <example> 41 /// <example>
42 /// <code> 42 /// <code>
43 /// [CanBeNull] object Test() => null; 43 /// [CanBeNull] object Test() => null;
44 /// 44 ///
45 /// void UseTest() { 45 /// void UseTest() {
46 /// var p = Test(); 46 /// var p = Test();
47 /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' 47 /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
48 /// } 48 /// }
49 /// </code> 49 /// </code>
50 /// </example> 50 /// </example>
51 [AttributeUsage( 51 [AttributeUsage(
52 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 52 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
53 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 53 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
54 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 54 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
55 public sealed class CanBeNullAttribute : Attribute 55 public sealed class CanBeNullAttribute : Attribute
56 { 56 {
57 } 57 }
58   58  
59 /// <summary> 59 /// <summary>
60 /// Indicates that the value of the marked element can never be <c>null</c>. 60 /// Indicates that the value of the marked element can never be <c>null</c>.
61 /// </summary> 61 /// </summary>
62 /// <example> 62 /// <example>
63 /// <code> 63 /// <code>
64 /// [NotNull] object Foo() { 64 /// [NotNull] object Foo() {
65 /// return null; // Warning: Possible 'null' assignment 65 /// return null; // Warning: Possible 'null' assignment
66 /// } 66 /// }
67 /// </code> 67 /// </code>
68 /// </example> 68 /// </example>
69 [AttributeUsage( 69 [AttributeUsage(
70 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 70 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
71 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 71 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
72 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 72 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
73 public sealed class NotNullAttribute : Attribute 73 public sealed class NotNullAttribute : Attribute
74 { 74 {
75 } 75 }
76   76  
77 /// <summary> 77 /// <summary>
78 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task 78 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task
79 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 79 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
80 /// or of the Lazy.Value property can never be null. 80 /// or of the Lazy.Value property can never be null.
81 /// </summary> 81 /// </summary>
82 /// <example> 82 /// <example>
83 /// <code> 83 /// <code>
84 /// public void Foo([ItemNotNull]List&lt;string&gt; books) 84 /// public void Foo([ItemNotNull]List&lt;string&gt; books)
85 /// { 85 /// {
86 /// foreach (var book in books) { 86 /// foreach (var book in books) {
87 /// if (book != null) // Warning: Expression is always true 87 /// if (book != null) // Warning: Expression is always true
88 /// Console.WriteLine(book.ToUpper()); 88 /// Console.WriteLine(book.ToUpper());
89 /// } 89 /// }
90 /// } 90 /// }
91 /// </code> 91 /// </code>
92 /// </example> 92 /// </example>
93 [AttributeUsage( 93 [AttributeUsage(
94 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 94 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
95 AttributeTargets.Delegate | AttributeTargets.Field)] 95 AttributeTargets.Delegate | AttributeTargets.Field)]
96 public sealed class ItemNotNullAttribute : Attribute 96 public sealed class ItemNotNullAttribute : Attribute
97 { 97 {
98 } 98 }
99   99  
100 /// <summary> 100 /// <summary>
101 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task 101 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task
102 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 102 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
103 /// or of the Lazy.Value property can be null. 103 /// or of the Lazy.Value property can be null.
104 /// </summary> 104 /// </summary>
105 /// <example> 105 /// <example>
106 /// <code> 106 /// <code>
107 /// public void Foo([ItemCanBeNull]List&lt;string&gt; books) 107 /// public void Foo([ItemCanBeNull]List&lt;string&gt; books)
108 /// { 108 /// {
109 /// foreach (var book in books) 109 /// foreach (var book in books)
110 /// { 110 /// {
111 /// // Warning: Possible 'System.NullReferenceException' 111 /// // Warning: Possible 'System.NullReferenceException'
112 /// Console.WriteLine(book.ToUpper()); 112 /// Console.WriteLine(book.ToUpper());
113 /// } 113 /// }
114 /// } 114 /// }
115 /// </code> 115 /// </code>
116 /// </example> 116 /// </example>
117 [AttributeUsage( 117 [AttributeUsage(
118 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 118 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
119 AttributeTargets.Delegate | AttributeTargets.Field)] 119 AttributeTargets.Delegate | AttributeTargets.Field)]
120 public sealed class ItemCanBeNullAttribute : Attribute 120 public sealed class ItemCanBeNullAttribute : Attribute
121 { 121 {
122 } 122 }
123   123  
124 /// <summary> 124 /// <summary>
125 /// Indicates that the marked method builds string by the format pattern and (optional) arguments. 125 /// Indicates that the marked method builds string by the format pattern and (optional) arguments.
126 /// The parameter, which contains the format string, should be given in constructor. The format string 126 /// The parameter, which contains the format string, should be given in constructor. The format string
127 /// should be in <see cref="string.Format(IFormatProvider,string,object[])" />-like form. 127 /// should be in <see cref="string.Format(IFormatProvider,string,object[])" />-like form.
128 /// </summary> 128 /// </summary>
129 /// <example> 129 /// <example>
130 /// <code> 130 /// <code>
131 /// [StringFormatMethod("message")] 131 /// [StringFormatMethod("message")]
132 /// void ShowError(string message, params object[] args) { /* do something */ } 132 /// void ShowError(string message, params object[] args) { /* do something */ }
133 /// 133 ///
134 /// void Foo() { 134 /// void Foo() {
135 /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string 135 /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
136 /// } 136 /// }
137 /// </code> 137 /// </code>
138 /// </example> 138 /// </example>
139 [AttributeUsage( 139 [AttributeUsage(
140 AttributeTargets.Constructor | AttributeTargets.Method | 140 AttributeTargets.Constructor | AttributeTargets.Method |
141 AttributeTargets.Property | AttributeTargets.Delegate)] 141 AttributeTargets.Property | AttributeTargets.Delegate)]
142 public sealed class StringFormatMethodAttribute : Attribute 142 public sealed class StringFormatMethodAttribute : Attribute
143 { 143 {
144 #region Public Enums, Properties and Fields -  
145   -  
146 [NotNull] -  
147 public string FormatParameterName { get; } -  
148   -  
149 #endregion -  
150   -  
151 #region Constructors, Destructors and Finalizers 144 #region Constructors, Destructors and Finalizers
152   145  
153 /// <param name="formatParameterName"> 146 /// <param name="formatParameterName">
154 /// Specifies which parameter of an annotated method should be treated as the format string 147 /// Specifies which parameter of an annotated method should be treated as the format string
155 /// </param> 148 /// </param>
156 public StringFormatMethodAttribute([NotNull] string formatParameterName) 149 public StringFormatMethodAttribute([NotNull] string formatParameterName)
157 { 150 {
158 FormatParameterName = formatParameterName; 151 FormatParameterName = formatParameterName;
159 } 152 }
160   153  
161 #endregion 154 #endregion
-   155  
-   156 #region Public Enums, Properties and Fields
-   157  
-   158 [NotNull] public string FormatParameterName { get; }
-   159  
-   160 #endregion
162 } 161 }
163   162  
164 /// <summary> 163 /// <summary>
165 /// Use this annotation to specify a type that contains static or const fields 164 /// Use this annotation to specify a type that contains static or const fields
166 /// with values for the annotated property/field/parameter. 165 /// with values for the annotated property/field/parameter.
167 /// The specified type will be used to improve completion suggestions. 166 /// The specified type will be used to improve completion suggestions.
168 /// </summary> 167 /// </summary>
169 /// <example> 168 /// <example>
170 /// <code> 169 /// <code>
171 /// namespace TestNamespace 170 /// namespace TestNamespace
172 /// { 171 /// {
173 /// public class Constants 172 /// public class Constants
174 /// { 173 /// {
175 /// public static int INT_CONST = 1; 174 /// public static int INT_CONST = 1;
176 /// public const string STRING_CONST = "1"; 175 /// public const string STRING_CONST = "1";
177 /// } 176 /// }
178 /// 177 ///
179 /// public class Class1 178 /// public class Class1
180 /// { 179 /// {
181 /// [ValueProvider("TestNamespace.Constants")] public int myField; 180 /// [ValueProvider("TestNamespace.Constants")] public int myField;
182 /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { } 181 /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { }
183 /// 182 ///
184 /// public void Test() 183 /// public void Test()
185 /// { 184 /// {
186 /// Foo(/*try completion here*/);// 185 /// Foo(/*try completion here*/);//
187 /// myField = /*try completion here*/ 186 /// myField = /*try completion here*/
188 /// } 187 /// }
189 /// } 188 /// }
190 /// } 189 /// }
191 /// </code> 190 /// </code>
192 /// </example> 191 /// </example>
193 [AttributeUsage( 192 [AttributeUsage(
194 AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, 193 AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field,
195 AllowMultiple = true)] 194 AllowMultiple = true)]
196 public sealed class ValueProviderAttribute : Attribute 195 public sealed class ValueProviderAttribute : Attribute
197 { 196 {
198 #region Public Enums, Properties and Fields -  
199   -  
200 [NotNull] -  
201 public string Name { get; } -  
202   -  
203 #endregion -  
204   -  
205 #region Constructors, Destructors and Finalizers 197 #region Constructors, Destructors and Finalizers
206   198  
207 public ValueProviderAttribute([NotNull] string name) 199 public ValueProviderAttribute([NotNull] string name)
208 { 200 {
209 Name = name; 201 Name = name;
210 } 202 }
211   203  
212 #endregion 204 #endregion
-   205  
-   206 #region Public Enums, Properties and Fields
-   207  
-   208 [NotNull] public string Name { get; }
-   209  
-   210 #endregion
213 } 211 }
214   212  
215 /// <summary> 213 /// <summary>
216 /// Indicates that the integral value falls into the specified interval. 214 /// Indicates that the integral value falls into the specified interval.
217 /// It's allowed to specify multiple non-intersecting intervals. 215 /// It's allowed to specify multiple non-intersecting intervals.
218 /// Values of interval boundaries are inclusive. 216 /// Values of interval boundaries are inclusive.
219 /// </summary> 217 /// </summary>
220 /// <example> 218 /// <example>
221 /// <code> 219 /// <code>
222 /// void Foo([ValueRange(0, 100)] int value) { 220 /// void Foo([ValueRange(0, 100)] int value) {
223 /// if (value == -1) { // Warning: Expression is always 'false' 221 /// if (value == -1) { // Warning: Expression is always 'false'
224 /// ... 222 /// ...
225 /// } 223 /// }
226 /// } 224 /// }
227 /// </code> 225 /// </code>
228 /// </example> 226 /// </example>
229 [AttributeUsage( 227 [AttributeUsage(
230 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | 228 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property |
231 AttributeTargets.Method | AttributeTargets.Delegate, 229 AttributeTargets.Method | AttributeTargets.Delegate,
232 AllowMultiple = true)] 230 AllowMultiple = true)]
233 public sealed class ValueRangeAttribute : Attribute 231 public sealed class ValueRangeAttribute : Attribute
234 { 232 {
235 #region Public Enums, Properties and Fields 233 #region Public Enums, Properties and Fields
236   234  
237 public object From { get; } 235 public object From { get; }
238   236  
239 public object To { get; } 237 public object To { get; }
240   238  
241 #endregion 239 #endregion
242   240  
243 #region Constructors, Destructors and Finalizers 241 #region Constructors, Destructors and Finalizers
244   242  
245 public ValueRangeAttribute(long from, long to) 243 public ValueRangeAttribute(long from, long to)
246 { 244 {
247 From = from; 245 From = from;
248 To = to; 246 To = to;
249 } 247 }
250   248  
251 public ValueRangeAttribute(ulong from, ulong to) 249 public ValueRangeAttribute(ulong from, ulong to)
252 { 250 {
253 From = from; 251 From = from;
254 To = to; 252 To = to;
255 } 253 }
256   254  
257 public ValueRangeAttribute(long value) 255 public ValueRangeAttribute(long value)
258 { 256 {
259 From = To = value; 257 From = To = value;
260 } 258 }
261   259  
262 public ValueRangeAttribute(ulong value) 260 public ValueRangeAttribute(ulong value)
263 { 261 {
264 From = To = value; 262 From = To = value;
265 } 263 }
266   264  
267 #endregion 265 #endregion
268 } 266 }
269   267  
270 /// <summary> 268 /// <summary>
271 /// Indicates that the integral value never falls below zero. 269 /// Indicates that the integral value never falls below zero.
272 /// </summary> 270 /// </summary>
273 /// <example> 271 /// <example>
274 /// <code> 272 /// <code>
275 /// void Foo([NonNegativeValue] int value) { 273 /// void Foo([NonNegativeValue] int value) {
276 /// if (value == -1) { // Warning: Expression is always 'false' 274 /// if (value == -1) { // Warning: Expression is always 'false'
277 /// ... 275 /// ...
278 /// } 276 /// }
279 /// } 277 /// }
280 /// </code> 278 /// </code>
281 /// </example> 279 /// </example>
282 [AttributeUsage( 280 [AttributeUsage(
283 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | 281 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property |
284 AttributeTargets.Method | AttributeTargets.Delegate)] 282 AttributeTargets.Method | AttributeTargets.Delegate)]
285 public sealed class NonNegativeValueAttribute : Attribute 283 public sealed class NonNegativeValueAttribute : Attribute
286 { 284 {
287 } 285 }
288   286  
289 /// <summary> 287 /// <summary>
290 /// Indicates that the function argument should be a string literal and match one 288 /// Indicates that the function argument should be a string literal and match one
291 /// of the parameters of the caller function. For example, ReSharper annotates 289 /// of the parameters of the caller function. For example, ReSharper annotates
292 /// the parameter of <see cref="System.ArgumentNullException" />. 290 /// the parameter of <see cref="System.ArgumentNullException" />.
293 /// </summary> 291 /// </summary>
294 /// <example> 292 /// <example>
295 /// <code> 293 /// <code>
296 /// void Foo(string param) { 294 /// void Foo(string param) {
297 /// if (param == null) 295 /// if (param == null)
298 /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol 296 /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
299 /// } 297 /// }
300 /// </code> 298 /// </code>
301 /// </example> 299 /// </example>
302 [AttributeUsage(AttributeTargets.Parameter)] 300 [AttributeUsage(AttributeTargets.Parameter)]
303 public sealed class InvokerParameterNameAttribute : Attribute 301 public sealed class InvokerParameterNameAttribute : Attribute
304 { 302 {
305 } 303 }
306   304  
307 /// <summary> 305 /// <summary>
308 /// Indicates that the method is contained in a type that implements 306 /// Indicates that the method is contained in a type that implements
309 /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method 307 /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
310 /// is used to notify that some property value changed. 308 /// is used to notify that some property value changed.
311 /// </summary> 309 /// </summary>
312 /// <remarks> 310 /// <remarks>
313 /// The method should be non-static and conform to one of the supported signatures: 311 /// The method should be non-static and conform to one of the supported signatures:
314 /// <list> 312 /// <list>
315 /// <item> 313 /// <item>
316 /// <c>NotifyChanged(string)</c> 314 /// <c>NotifyChanged(string)</c>
317 /// </item> 315 /// </item>
318 /// <item> 316 /// <item>
319 /// <c>NotifyChanged(params string[])</c> 317 /// <c>NotifyChanged(params string[])</c>
320 /// </item> 318 /// </item>
321 /// <item> 319 /// <item>
322 /// <c>NotifyChanged{T}(Expression{Func{T}})</c> 320 /// <c>NotifyChanged{T}(Expression{Func{T}})</c>
323 /// </item> 321 /// </item>
324 /// <item> 322 /// <item>
325 /// <c>NotifyChanged{T,U}(Expression{Func{T,U}})</c> 323 /// <c>NotifyChanged{T,U}(Expression{Func{T,U}})</c>
326 /// </item> 324 /// </item>
327 /// <item> 325 /// <item>
328 /// <c>SetProperty{T}(ref T, T, string)</c> 326 /// <c>SetProperty{T}(ref T, T, string)</c>
329 /// </item> 327 /// </item>
330 /// </list> 328 /// </list>
331 /// </remarks> 329 /// </remarks>
332 /// <example> 330 /// <example>
333 /// <code> 331 /// <code>
334 /// public class Foo : INotifyPropertyChanged { 332 /// public class Foo : INotifyPropertyChanged {
335 /// public event PropertyChangedEventHandler PropertyChanged; 333 /// public event PropertyChangedEventHandler PropertyChanged;
336 /// 334 ///
337 /// [NotifyPropertyChangedInvocator] 335 /// [NotifyPropertyChangedInvocator]
338 /// protected virtual void NotifyChanged(string propertyName) { ... } 336 /// protected virtual void NotifyChanged(string propertyName) { ... }
339 /// 337 ///
340 /// string _name; 338 /// string _name;
341 /// 339 ///
342 /// public string Name { 340 /// public string Name {
343 /// get { return _name; } 341 /// get { return _name; }
344 /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } 342 /// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
345 /// } 343 /// }
346 /// } 344 /// }
347 /// </code> 345 /// </code>
348 /// Examples of generated notifications: 346 /// Examples of generated notifications:
349 /// <list> 347 /// <list>
350 /// <item> 348 /// <item>
351 /// <c>NotifyChanged("Property")</c> 349 /// <c>NotifyChanged("Property")</c>
352 /// </item> 350 /// </item>
353 /// <item> 351 /// <item>
354 /// <c>NotifyChanged(() =&gt; Property)</c> 352 /// <c>NotifyChanged(() =&gt; Property)</c>
355 /// </item> 353 /// </item>
356 /// <item> 354 /// <item>
357 /// <c>NotifyChanged((VM x) =&gt; x.Property)</c> 355 /// <c>NotifyChanged((VM x) =&gt; x.Property)</c>
358 /// </item> 356 /// </item>
359 /// <item> 357 /// <item>
360 /// <c>SetProperty(ref myField, value, "Property")</c> 358 /// <c>SetProperty(ref myField, value, "Property")</c>
361 /// </item> 359 /// </item>
362 /// </list> 360 /// </list>
363 /// </example> 361 /// </example>
364 [AttributeUsage(AttributeTargets.Method)] 362 [AttributeUsage(AttributeTargets.Method)]
365 public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute 363 public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
366 { 364 {
367 #region Public Enums, Properties and Fields 365 #region Public Enums, Properties and Fields
368   -  
369 [CanBeNull] 366  
370 public string ParameterName { get; } 367 [CanBeNull] public string ParameterName { get; }
371   368  
372 #endregion 369 #endregion
373   370  
374 #region Constructors, Destructors and Finalizers 371 #region Constructors, Destructors and Finalizers
375   372  
376 public NotifyPropertyChangedInvocatorAttribute() 373 public NotifyPropertyChangedInvocatorAttribute()
377 { 374 {
378 } 375 }
379   376  
380 public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) 377 public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
381 { 378 {
382 ParameterName = parameterName; 379 ParameterName = parameterName;
383 } 380 }
384   381  
385 #endregion 382 #endregion
386 } 383 }
387   384  
388 /// <summary> 385 /// <summary>
389 /// Describes dependency between method input and output. 386 /// Describes dependency between method input and output.
390 /// </summary> 387 /// </summary>
391 /// <syntax> 388 /// <syntax>
392 /// <p>Function Definition Table syntax:</p> 389 /// <p>Function Definition Table syntax:</p>
393 /// <list> 390 /// <list>
394 /// <item>FDT ::= FDTRow [;FDTRow]*</item> 391 /// <item>FDT ::= FDTRow [;FDTRow]*</item>
395 /// <item>FDTRow ::= Input =&gt; Output | Output &lt;= Input</item> 392 /// <item>FDTRow ::= Input =&gt; Output | Output &lt;= Input</item>
396 /// <item>Input ::= ParameterName: Value [, Input]*</item> 393 /// <item>Input ::= ParameterName: Value [, Input]*</item>
397 /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item> 394 /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
398 /// <item>Value ::= true | false | null | notnull | canbenull</item> 395 /// <item>Value ::= true | false | null | notnull | canbenull</item>
399 /// </list> 396 /// </list>
400 /// If the method has a single input parameter, its name could be omitted.<br /> 397 /// If the method has a single input parameter, its name could be omitted.<br />
401 /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for the method output 398 /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for the method output
402 /// means that the method doesn't return normally (throws or terminates the process).<br /> 399 /// means that the method doesn't return normally (throws or terminates the process).<br />
403 /// Value <c>canbenull</c> is only applicable for output parameters.<br /> 400 /// Value <c>canbenull</c> is only applicable for output parameters.<br />
404 /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute 401 /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute
405 /// with rows separated by semicolon. There is no notion of order rows, all rows are checked 402 /// with rows separated by semicolon. There is no notion of order rows, all rows are checked
406 /// for applicability and applied per each program state tracked by the analysis engine.<br /> 403 /// for applicability and applied per each program state tracked by the analysis engine.<br />
407 /// </syntax> 404 /// </syntax>
408 /// <examples> 405 /// <examples>
409 /// <list> 406 /// <list>
410 /// <item> 407 /// <item>
411 /// <code> 408 /// <code>
412 /// [ContractAnnotation("=&gt; halt")] 409 /// [ContractAnnotation("=&gt; halt")]
413 /// public void TerminationMethod() 410 /// public void TerminationMethod()
414 /// </code> 411 /// </code>
415 /// </item> 412 /// </item>
416 /// <item> 413 /// <item>
417 /// <code> 414 /// <code>
418 /// [ContractAnnotation("null &lt;= param:null")] // reverse condition syntax 415 /// [ContractAnnotation("null &lt;= param:null")] // reverse condition syntax
419 /// public string GetName(string surname) 416 /// public string GetName(string surname)
420 /// </code> 417 /// </code>
421 /// </item> 418 /// </item>
422 /// <item> 419 /// <item>
423 /// <code> 420 /// <code>
424 /// [ContractAnnotation("s:null =&gt; true")] 421 /// [ContractAnnotation("s:null =&gt; true")]
425 /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() 422 /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
426 /// </code> 423 /// </code>
427 /// </item> 424 /// </item>
428 /// <item> 425 /// <item>
429 /// <code> 426 /// <code>
430 /// // A method that returns null if the parameter is null, 427 /// // A method that returns null if the parameter is null,
431 /// // and not null if the parameter is not null 428 /// // and not null if the parameter is not null
432 /// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")] 429 /// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")]
433 /// public object Transform(object data) 430 /// public object Transform(object data)
434 /// </code> 431 /// </code>
435 /// </item> 432 /// </item>
436 /// <item> 433 /// <item>
437 /// <code> 434 /// <code>
438 /// [ContractAnnotation("=&gt; true, result: notnull; =&gt; false, result: null")] 435 /// [ContractAnnotation("=&gt; true, result: notnull; =&gt; false, result: null")]
439 /// public bool TryParse(string s, out Person result) 436 /// public bool TryParse(string s, out Person result)
440 /// </code> 437 /// </code>
441 /// </item> 438 /// </item>
442 /// </list> 439 /// </list>
443 /// </examples> 440 /// </examples>
444 [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] 441 [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
445 public sealed class ContractAnnotationAttribute : Attribute 442 public sealed class ContractAnnotationAttribute : Attribute
446 { 443 {
447 #region Public Enums, Properties and Fields 444 #region Public Enums, Properties and Fields
448   -  
449 [NotNull] 445  
450 public string Contract { get; } 446 [NotNull] public string Contract { get; }
451   447  
452 public bool ForceFullStates { get; } 448 public bool ForceFullStates { get; }
453   449  
454 #endregion 450 #endregion
455   451  
456 #region Constructors, Destructors and Finalizers 452 #region Constructors, Destructors and Finalizers
457   453  
458 public ContractAnnotationAttribute([NotNull] string contract) 454 public ContractAnnotationAttribute([NotNull] string contract)
459 : this(contract, false) 455 : this(contract, false)
460 { 456 {
461 } 457 }
462   458  
463 public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) 459 public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
464 { 460 {
465 Contract = contract; 461 Contract = contract;
466 ForceFullStates = forceFullStates; 462 ForceFullStates = forceFullStates;
467 } 463 }
468   464  
469 #endregion 465 #endregion
470 } 466 }
471   467  
472 /// <summary> 468 /// <summary>
473 /// Indicates whether the marked element should be localized. 469 /// Indicates whether the marked element should be localized.
474 /// </summary> 470 /// </summary>
475 /// <example> 471 /// <example>
476 /// <code> 472 /// <code>
477 /// [LocalizationRequiredAttribute(true)] 473 /// [LocalizationRequiredAttribute(true)]
478 /// class Foo { 474 /// class Foo {
479 /// string str = "my string"; // Warning: Localizable string 475 /// string str = "my string"; // Warning: Localizable string
480 /// } 476 /// }
481 /// </code> 477 /// </code>
482 /// </example> 478 /// </example>
483 [AttributeUsage(AttributeTargets.All)] 479 [AttributeUsage(AttributeTargets.All)]
484 public sealed class LocalizationRequiredAttribute : Attribute 480 public sealed class LocalizationRequiredAttribute : Attribute
485 { 481 {
486 #region Public Enums, Properties and Fields 482 #region Public Enums, Properties and Fields
487   483  
488 public bool Required { get; } 484 public bool Required { get; }
489   485  
490 #endregion 486 #endregion
491   487  
492 #region Constructors, Destructors and Finalizers 488 #region Constructors, Destructors and Finalizers
493   489  
494 public LocalizationRequiredAttribute() : this(true) 490 public LocalizationRequiredAttribute() : this(true)
495 { 491 {
496 } 492 }
497   493  
498 public LocalizationRequiredAttribute(bool required) 494 public LocalizationRequiredAttribute(bool required)
499 { 495 {
500 Required = required; 496 Required = required;
501 } 497 }
502   498  
503 #endregion 499 #endregion
504 } 500 }
505   501  
506 /// <summary> 502 /// <summary>
507 /// Indicates that the value of the marked type (or its derivatives) 503 /// Indicates that the value of the marked type (or its derivatives)
508 /// cannot be compared using '==' or '!=' operators and <c>Equals()</c> 504 /// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
509 /// should be used instead. However, using '==' or '!=' for comparison 505 /// should be used instead. However, using '==' or '!=' for comparison
510 /// with <c>null</c> is always permitted. 506 /// with <c>null</c> is always permitted.
511 /// </summary> 507 /// </summary>
512 /// <example> 508 /// <example>
513 /// <code> 509 /// <code>
514 /// [CannotApplyEqualityOperator] 510 /// [CannotApplyEqualityOperator]
515 /// class NoEquality { } 511 /// class NoEquality { }
516 /// 512 ///
517 /// class UsesNoEquality { 513 /// class UsesNoEquality {
518 /// void Test() { 514 /// void Test() {
519 /// var ca1 = new NoEquality(); 515 /// var ca1 = new NoEquality();
520 /// var ca2 = new NoEquality(); 516 /// var ca2 = new NoEquality();
521 /// if (ca1 != null) { // OK 517 /// if (ca1 != null) { // OK
522 /// bool condition = ca1 == ca2; // Warning 518 /// bool condition = ca1 == ca2; // Warning
523 /// } 519 /// }
524 /// } 520 /// }
525 /// } 521 /// }
526 /// </code> 522 /// </code>
527 /// </example> 523 /// </example>
528 [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] 524 [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
529 public sealed class CannotApplyEqualityOperatorAttribute : Attribute 525 public sealed class CannotApplyEqualityOperatorAttribute : Attribute
530 { 526 {
531 } 527 }
532   528  
533 /// <summary> 529 /// <summary>
534 /// When applied to a target attribute, specifies a requirement for any type marked 530 /// When applied to a target attribute, specifies a requirement for any type marked
535 /// with the target attribute to implement or inherit specific type or types. 531 /// with the target attribute to implement or inherit specific type or types.
536 /// </summary> 532 /// </summary>
537 /// <example> 533 /// <example>
538 /// <code> 534 /// <code>
539 /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement 535 /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
540 /// class ComponentAttribute : Attribute { } 536 /// class ComponentAttribute : Attribute { }
541 /// 537 ///
542 /// [Component] // ComponentAttribute requires implementing IComponent interface 538 /// [Component] // ComponentAttribute requires implementing IComponent interface
543 /// class MyComponent : IComponent { } 539 /// class MyComponent : IComponent { }
544 /// </code> 540 /// </code>
545 /// </example> 541 /// </example>
546 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 542 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
547 [BaseTypeRequired(typeof(Attribute))] 543 [BaseTypeRequired(typeof(Attribute))]
548 public sealed class BaseTypeRequiredAttribute : Attribute 544 public sealed class BaseTypeRequiredAttribute : Attribute
549 { 545 {
550 #region Public Enums, Properties and Fields -  
551   -  
552 [NotNull] -  
553 public Type BaseType { get; } -  
554   -  
555 #endregion -  
556   -  
557 #region Constructors, Destructors and Finalizers 546 #region Constructors, Destructors and Finalizers
558   547  
559 public BaseTypeRequiredAttribute([NotNull] Type baseType) 548 public BaseTypeRequiredAttribute([NotNull] Type baseType)
560 { 549 {
561 BaseType = baseType; 550 BaseType = baseType;
562 } 551 }
563   552  
564 #endregion 553 #endregion
-   554  
-   555 #region Public Enums, Properties and Fields
-   556  
-   557 [NotNull] public Type BaseType { get; }
-   558  
-   559 #endregion
565 } 560 }
566   561  
567 /// <summary> 562 /// <summary>
568 /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), 563 /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),
569 /// so this symbol will not be reported as unused (as well as by other usage inspections). 564 /// so this symbol will not be reported as unused (as well as by other usage inspections).
570 /// </summary> 565 /// </summary>
571 [AttributeUsage(AttributeTargets.All)] 566 [AttributeUsage(AttributeTargets.All)]
572 public sealed class UsedImplicitlyAttribute : Attribute 567 public sealed class UsedImplicitlyAttribute : Attribute
573 { 568 {
574 #region Public Enums, Properties and Fields 569 #region Public Enums, Properties and Fields
575   570  
576 public ImplicitUseKindFlags UseKindFlags { get; } 571 public ImplicitUseKindFlags UseKindFlags { get; }
577   572  
578 public ImplicitUseTargetFlags TargetFlags { get; } 573 public ImplicitUseTargetFlags TargetFlags { get; }
579   574  
580 #endregion 575 #endregion
581   576  
582 #region Constructors, Destructors and Finalizers 577 #region Constructors, Destructors and Finalizers
583   578  
584 public UsedImplicitlyAttribute() 579 public UsedImplicitlyAttribute()
585 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) 580 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
586 { 581 {
587 } 582 }
588   583  
589 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) 584 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
590 : this(useKindFlags, ImplicitUseTargetFlags.Default) 585 : this(useKindFlags, ImplicitUseTargetFlags.Default)
591 { 586 {
592 } 587 }
593   588  
594 public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) 589 public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
595 : this(ImplicitUseKindFlags.Default, targetFlags) 590 : this(ImplicitUseKindFlags.Default, targetFlags)
596 { 591 {
597 } 592 }
598   593  
599 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 594 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
600 { 595 {
601 UseKindFlags = useKindFlags; 596 UseKindFlags = useKindFlags;
602 TargetFlags = targetFlags; 597 TargetFlags = targetFlags;
603 } 598 }
604   599  
605 #endregion 600 #endregion
606 } 601 }
607   602  
608 /// <summary> 603 /// <summary>
609 /// Can be applied to attributes, type parameters, and parameters of a type assignable from <see cref="System.Type" /> 604 /// Can be applied to attributes, type parameters, and parameters of a type assignable from <see cref="System.Type" />
610 /// . 605 /// .
611 /// When applied to an attribute, the decorated attribute behaves the same as <see cref="UsedImplicitlyAttribute" />. 606 /// When applied to an attribute, the decorated attribute behaves the same as <see cref="UsedImplicitlyAttribute" />.
612 /// When applied to a type parameter or to a parameter of type <see cref="System.Type" />, indicates that the 607 /// When applied to a type parameter or to a parameter of type <see cref="System.Type" />, indicates that the
613 /// corresponding type 608 /// corresponding type
614 /// is used implicitly. 609 /// is used implicitly.
615 /// </summary> 610 /// </summary>
616 [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)] 611 [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)]
617 public sealed class MeansImplicitUseAttribute : Attribute 612 public sealed class MeansImplicitUseAttribute : Attribute
618 { 613 {
619 #region Public Enums, Properties and Fields 614 #region Public Enums, Properties and Fields
620   -  
621 [UsedImplicitly] 615  
622 public ImplicitUseKindFlags UseKindFlags { get; } -  
623   616 [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; }
624 [UsedImplicitly] 617  
625 public ImplicitUseTargetFlags TargetFlags { get; } 618 [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; }
626   619  
627 #endregion 620 #endregion
628   621  
629 #region Constructors, Destructors and Finalizers 622 #region Constructors, Destructors and Finalizers
630   623  
631 public MeansImplicitUseAttribute() 624 public MeansImplicitUseAttribute()
632 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) 625 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
633 { 626 {
634 } 627 }
635   628  
636 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) 629 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
637 : this(useKindFlags, ImplicitUseTargetFlags.Default) 630 : this(useKindFlags, ImplicitUseTargetFlags.Default)
638 { 631 {
639 } 632 }
640   633  
641 public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) 634 public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
642 : this(ImplicitUseKindFlags.Default, targetFlags) 635 : this(ImplicitUseKindFlags.Default, targetFlags)
643 { 636 {
644 } 637 }
645   638  
646 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 639 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
647 { 640 {
648 UseKindFlags = useKindFlags; 641 UseKindFlags = useKindFlags;
649 TargetFlags = targetFlags; 642 TargetFlags = targetFlags;
650 } 643 }
651   644  
652 #endregion 645 #endregion
653 } 646 }
654   647  
655 /// <summary> 648 /// <summary>
656 /// Specify the details of implicitly used symbol when it is marked 649 /// Specify the details of implicitly used symbol when it is marked
657 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. 650 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />.
658 /// </summary> 651 /// </summary>
659 [Flags] 652 [Flags]
660 public enum ImplicitUseKindFlags 653 public enum ImplicitUseKindFlags
661 { 654 {
662 Default = Access | Assign | InstantiatedWithFixedConstructorSignature, 655 Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
663   656  
664 /// <summary>Only entity marked with attribute considered used.</summary> 657 /// <summary>Only entity marked with attribute considered used.</summary>
665 Access = 1, 658 Access = 1,
666   659  
667 /// <summary>Indicates implicit assignment to a member.</summary> 660 /// <summary>Indicates implicit assignment to a member.</summary>
668 Assign = 2, 661 Assign = 2,
669   662  
670 /// <summary> 663 /// <summary>
671 /// Indicates implicit instantiation of a type with fixed constructor signature. 664 /// Indicates implicit instantiation of a type with fixed constructor signature.
672 /// That means any unused constructor parameters won't be reported as such. 665 /// That means any unused constructor parameters won't be reported as such.
673 /// </summary> 666 /// </summary>
674 InstantiatedWithFixedConstructorSignature = 4, 667 InstantiatedWithFixedConstructorSignature = 4,
675   668  
676 /// <summary>Indicates implicit instantiation of a type.</summary> 669 /// <summary>Indicates implicit instantiation of a type.</summary>
677 InstantiatedNoFixedConstructorSignature = 8 670 InstantiatedNoFixedConstructorSignature = 8
678 } 671 }
679   672  
680 /// <summary> 673 /// <summary>
681 /// Specify what is considered to be used implicitly when marked 674 /// Specify what is considered to be used implicitly when marked
682 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />. 675 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />.
683 /// </summary> 676 /// </summary>
684 [Flags] 677 [Flags]
685 public enum ImplicitUseTargetFlags 678 public enum ImplicitUseTargetFlags
686 { 679 {
687 Default = Itself, 680 Default = Itself,
688   681  
689 Itself = 1, 682 Itself = 1,
690   683  
691 /// <summary>Members of entity marked with attribute are considered used.</summary> 684 /// <summary>Members of entity marked with attribute are considered used.</summary>
692 Members = 2, 685 Members = 2,
693   686  
694 /// <summary> Inherited entities are considered used. </summary> 687 /// <summary> Inherited entities are considered used. </summary>
695 WithInheritors = 4, 688 WithInheritors = 4,
696   689  
697 /// <summary>Entity marked with attribute and all its members considered used.</summary> 690 /// <summary>Entity marked with attribute and all its members considered used.</summary>
698 WithMembers = Itself | Members 691 WithMembers = Itself | Members
699 } 692 }
700   693  
701 /// <summary> 694 /// <summary>
702 /// This attribute is intended to mark publicly available API 695 /// This attribute is intended to mark publicly available API
703 /// which should not be removed and so is treated as used. 696 /// which should not be removed and so is treated as used.
704 /// </summary> 697 /// </summary>
705 [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] 698 [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
706 [AttributeUsage(AttributeTargets.All, Inherited = false)] 699 [AttributeUsage(AttributeTargets.All, Inherited = false)]
707 public sealed class PublicAPIAttribute : Attribute 700 public sealed class PublicAPIAttribute : Attribute
708 { 701 {
709 #region Public Enums, Properties and Fields 702 #region Public Enums, Properties and Fields
710   -  
711 [CanBeNull] 703  
712 public string Comment { get; } 704 [CanBeNull] public string Comment { get; }
713   705  
714 #endregion 706 #endregion
715   707  
716 #region Constructors, Destructors and Finalizers 708 #region Constructors, Destructors and Finalizers
717   709  
718 public PublicAPIAttribute() 710 public PublicAPIAttribute()
719 { 711 {
720 } 712 }
721   713  
722 public PublicAPIAttribute([NotNull] string comment) 714 public PublicAPIAttribute([NotNull] string comment)
723 { 715 {
724 Comment = comment; 716 Comment = comment;
725 } 717 }
726   718  
727 #endregion 719 #endregion
728 } 720 }
729   721  
730 /// <summary> 722 /// <summary>
731 /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. 723 /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack.
732 /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. 724 /// If the parameter is a delegate, indicates that delegate is executed while the method is executed.
733 /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. 725 /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed.
734 /// </summary> 726 /// </summary>
735 [AttributeUsage(AttributeTargets.Parameter)] 727 [AttributeUsage(AttributeTargets.Parameter)]
736 public sealed class InstantHandleAttribute : Attribute 728 public sealed class InstantHandleAttribute : Attribute
737 { 729 {
738 } 730 }
739   731  
740 /// <summary> 732 /// <summary>
741 /// Indicates that a method does not make any observable state changes. 733 /// Indicates that a method does not make any observable state changes.
742 /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>. 734 /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>.
743 /// </summary> 735 /// </summary>
744 /// <example> 736 /// <example>
745 /// <code> 737 /// <code>
746 /// [Pure] int Multiply(int x, int y) => x * y; 738 /// [Pure] int Multiply(int x, int y) => x * y;
747 /// 739 ///
748 /// void M() { 740 /// void M() {
749 /// Multiply(123, 42); // Warning: Return value of pure method is not used 741 /// Multiply(123, 42); // Warning: Return value of pure method is not used
750 /// } 742 /// }
751 /// </code> 743 /// </code>
752 /// </example> 744 /// </example>
753 [AttributeUsage(AttributeTargets.Method)] 745 [AttributeUsage(AttributeTargets.Method)]
754 public sealed class PureAttribute : Attribute 746 public sealed class PureAttribute : Attribute
755 { 747 {
756 } 748 }
757   749  
758 /// <summary> 750 /// <summary>
759 /// Indicates that the return value of the method invocation must be used. 751 /// Indicates that the return value of the method invocation must be used.
760 /// </summary> 752 /// </summary>
761 /// <remarks> 753 /// <remarks>
762 /// Methods decorated with this attribute (in contrast to pure methods) might change state, 754 /// Methods decorated with this attribute (in contrast to pure methods) might change state,
763 /// but make no sense without using their return value. <br /> 755 /// but make no sense without using their return value. <br />
764 /// Similarly to <see cref="PureAttribute" />, this attribute 756 /// Similarly to <see cref="PureAttribute" />, this attribute
765 /// will help detecting usages of the method when the return value in not used. 757 /// will help detecting usages of the method when the return value in not used.
766 /// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g. 758 /// Additionally, you can optionally specify a custom message, which will be used when showing warnings, e.g.
767 /// <code>[MustUseReturnValue("Use the return value to...")]</code>. 759 /// <code>[MustUseReturnValue("Use the return value to...")]</code>.
768 /// </remarks> 760 /// </remarks>
769 [AttributeUsage(AttributeTargets.Method)] 761 [AttributeUsage(AttributeTargets.Method)]
770 public sealed class MustUseReturnValueAttribute : Attribute 762 public sealed class MustUseReturnValueAttribute : Attribute
771 { 763 {
772 #region Public Enums, Properties and Fields 764 #region Public Enums, Properties and Fields
773   -  
774 [CanBeNull] 765  
775 public string Justification { get; } 766 [CanBeNull] public string Justification { get; }
776   767  
777 #endregion 768 #endregion
778   769  
779 #region Constructors, Destructors and Finalizers 770 #region Constructors, Destructors and Finalizers
780   771  
781 public MustUseReturnValueAttribute() 772 public MustUseReturnValueAttribute()
782 { 773 {
783 } 774 }
784   775  
785 public MustUseReturnValueAttribute([NotNull] string justification) 776 public MustUseReturnValueAttribute([NotNull] string justification)
786 { 777 {
787 Justification = justification; 778 Justification = justification;
788 } 779 }
789   780  
790 #endregion 781 #endregion
791 } 782 }
792   783  
793 /// <summary> 784 /// <summary>
794 /// Indicates the type member or parameter of some type, that should be used instead of all other ways 785 /// Indicates the type member or parameter of some type, that should be used instead of all other ways
795 /// to get the value of that type. This annotation is useful when you have some "context" value evaluated 786 /// to get the value of that type. This annotation is useful when you have some "context" value evaluated
796 /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. 787 /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one.
797 /// </summary> 788 /// </summary>
798 /// <example> 789 /// <example>
799 /// <code> 790 /// <code>
800 /// class Foo { 791 /// class Foo {
801 /// [ProvidesContext] IBarService _barService = ...; 792 /// [ProvidesContext] IBarService _barService = ...;
802 /// 793 ///
803 /// void ProcessNode(INode node) { 794 /// void ProcessNode(INode node) {
804 /// DoSomething(node, node.GetGlobalServices().Bar); 795 /// DoSomething(node, node.GetGlobalServices().Bar);
805 /// // ^ Warning: use value of '_barService' field 796 /// // ^ Warning: use value of '_barService' field
806 /// } 797 /// }
807 /// } 798 /// }
808 /// </code> 799 /// </code>
809 /// </example> 800 /// </example>
810 [AttributeUsage( 801 [AttributeUsage(
811 AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | 802 AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method |
812 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | 803 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
813 AttributeTargets.GenericParameter)] 804 AttributeTargets.GenericParameter)]
814 public sealed class ProvidesContextAttribute : Attribute 805 public sealed class ProvidesContextAttribute : Attribute
815 { 806 {
816 } 807 }
817   808  
818 /// <summary> 809 /// <summary>
819 /// Indicates that a parameter is a path to a file or a folder within a web project. 810 /// Indicates that a parameter is a path to a file or a folder within a web project.
820 /// Path can be relative or absolute, starting from web root (~). 811 /// Path can be relative or absolute, starting from web root (~).
821 /// </summary> 812 /// </summary>
822 [AttributeUsage(AttributeTargets.Parameter)] 813 [AttributeUsage(AttributeTargets.Parameter)]
823 public sealed class PathReferenceAttribute : Attribute 814 public sealed class PathReferenceAttribute : Attribute
824 { 815 {
825 #region Public Enums, Properties and Fields 816 #region Public Enums, Properties and Fields
826   -  
827 [CanBeNull] 817  
828 public string BasePath { get; } 818 [CanBeNull] public string BasePath { get; }
829   819  
830 #endregion 820 #endregion
831   821  
832 #region Constructors, Destructors and Finalizers 822 #region Constructors, Destructors and Finalizers
833   823  
834 public PathReferenceAttribute() 824 public PathReferenceAttribute()
835 { 825 {
836 } 826 }
837   827  
838 public PathReferenceAttribute([NotNull] [PathReference] string basePath) 828 public PathReferenceAttribute([NotNull] [PathReference] string basePath)
839 { 829 {
840 BasePath = basePath; 830 BasePath = basePath;
841 } 831 }
842   832  
843 #endregion 833 #endregion
844 } 834 }
845   835  
846 /// <summary> 836 /// <summary>
847 /// An extension method marked with this attribute is processed by code completion 837 /// An extension method marked with this attribute is processed by code completion
848 /// as a 'Source Template'. When the extension method is completed over some expression, its source code 838 /// as a 'Source Template'. When the extension method is completed over some expression, its source code
849 /// is automatically expanded like a template at call site. 839 /// is automatically expanded like a template at call site.
850 /// </summary> 840 /// </summary>
851 /// <remarks> 841 /// <remarks>
852 /// Template method body can contain valid source code and/or special comments starting with '$'. 842 /// Template method body can contain valid source code and/or special comments starting with '$'.
853 /// Text inside these comments is added as source code when the template is applied. Template parameters 843 /// Text inside these comments is added as source code when the template is applied. Template parameters
854 /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. 844 /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs.
855 /// Use the <see cref="MacroAttribute" /> attribute to specify macros for parameters. 845 /// Use the <see cref="MacroAttribute" /> attribute to specify macros for parameters.
856 /// </remarks> 846 /// </remarks>
857 /// <example> 847 /// <example>
858 /// In this example, the 'forEach' method is a source template available over all values 848 /// In this example, the 'forEach' method is a source template available over all values
859 /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: 849 /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
860 /// <code> 850 /// <code>
861 /// [SourceTemplate] 851 /// [SourceTemplate]
862 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; xs) { 852 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; xs) {
863 /// foreach (var x in xs) { 853 /// foreach (var x in xs) {
864 /// //$ $END$ 854 /// //$ $END$
865 /// } 855 /// }
866 /// } 856 /// }
867 /// </code> 857 /// </code>
868 /// </example> 858 /// </example>
869 [AttributeUsage(AttributeTargets.Method)] 859 [AttributeUsage(AttributeTargets.Method)]
870 public sealed class SourceTemplateAttribute : Attribute 860 public sealed class SourceTemplateAttribute : Attribute
871 { 861 {
872 } 862 }
873   863  
874 /// <summary> 864 /// <summary>
875 /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>. 865 /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>.
876 /// </summary> 866 /// </summary>
877 /// <remarks> 867 /// <remarks>
878 /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression 868 /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression
879 /// is defined in the <see cref="MacroAttribute.Expression" /> property. When applied on a method, the target 869 /// is defined in the <see cref="MacroAttribute.Expression" /> property. When applied on a method, the target
880 /// template parameter is defined in the <see cref="MacroAttribute.Target" /> property. To apply the macro silently 870 /// template parameter is defined in the <see cref="MacroAttribute.Target" /> property. To apply the macro silently
881 /// for the parameter, set the <see cref="MacroAttribute.Editable" /> property value = -1. 871 /// for the parameter, set the <see cref="MacroAttribute.Editable" /> property value = -1.
882 /// </remarks> 872 /// </remarks>
883 /// <example> 873 /// <example>
884 /// Applying the attribute on a source template method: 874 /// Applying the attribute on a source template method:
885 /// <code> 875 /// <code>
886 /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] 876 /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
887 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; collection) { 877 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; collection) {
888 /// foreach (var item in collection) { 878 /// foreach (var item in collection) {
889 /// //$ $END$ 879 /// //$ $END$
890 /// } 880 /// }
891 /// } 881 /// }
892 /// </code> 882 /// </code>
893 /// Applying the attribute on a template method parameter: 883 /// Applying the attribute on a template method parameter:
894 /// <code> 884 /// <code>
895 /// [SourceTemplate] 885 /// [SourceTemplate]
896 /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { 886 /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
897 /// /*$ var $x$Id = "$newguid$" + x.ToString(); 887 /// /*$ var $x$Id = "$newguid$" + x.ToString();
898 /// x.DoSomething($x$Id); */ 888 /// x.DoSomething($x$Id); */
899 /// } 889 /// }
900 /// </code> 890 /// </code>
901 /// </example> 891 /// </example>
902 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] 892 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)]
903 public sealed class MacroAttribute : Attribute 893 public sealed class MacroAttribute : Attribute
904 { 894 {
905 #region Public Enums, Properties and Fields 895 #region Public Enums, Properties and Fields
906   896  
907 /// <summary> 897 /// <summary>
908 /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see> 898 /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see>
909 /// parameter when the template is expanded. 899 /// parameter when the template is expanded.
910 /// </summary> 900 /// </summary>
911 [CanBeNull] 901 [CanBeNull]
912 public string Expression { get; set; } 902 public string Expression { get; set; }
913   903  
914 /// <summary> 904 /// <summary>
915 /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. 905 /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
916 /// </summary> 906 /// </summary>
917 /// <remarks> 907 /// <remarks>
918 /// If the target parameter is used several times in the template, only one occurrence becomes editable; 908 /// If the target parameter is used several times in the template, only one occurrence becomes editable;
919 /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, 909 /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence,
920 /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. 910 /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1.
921 /// </remarks> 911 /// </remarks>
922 public int Editable { get; set; } 912 public int Editable { get; set; }
923   913  
924 /// <summary> 914 /// <summary>
925 /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the 915 /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the
926 /// <see cref="MacroAttribute" /> is applied on a template method. 916 /// <see cref="MacroAttribute" /> is applied on a template method.
927 /// </summary> 917 /// </summary>
928 [CanBeNull] 918 [CanBeNull]
929 public string Target { get; set; } 919 public string Target { get; set; }
930   920  
931 #endregion 921 #endregion
932 } 922 }
933   923  
934 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, 924 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
935 AllowMultiple = true)] 925 AllowMultiple = true)]
936 public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute 926 public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
937 { 927 {
938 #region Public Enums, Properties and Fields -  
939   -  
940 [NotNull] -  
941 public string Format { get; } -  
942   -  
943 #endregion -  
944   -  
945 #region Constructors, Destructors and Finalizers 928 #region Constructors, Destructors and Finalizers
946   929  
947 public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) 930 public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format)
948 { 931 {
949 Format = format; 932 Format = format;
950 } 933 }
951   934  
952 #endregion 935 #endregion
953 } -  
954   -  
955 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, -  
956 AllowMultiple = true)] -  
957 public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute -  
958 { 936  
959 #region Public Enums, Properties and Fields -  
960   937 #region Public Enums, Properties and Fields
961 [NotNull] 938  
-   939 [NotNull] public string Format { get; }
-   940  
-   941 #endregion
-   942 }
-   943  
962 public string Format { get; } 944 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
963   945 AllowMultiple = true)]
964 #endregion 946 public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
965   947 {
966 #region Constructors, Destructors and Finalizers 948 #region Constructors, Destructors and Finalizers
967   949  
968 public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) 950 public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format)
969 { 951 {
970 Format = format; 952 Format = format;
971 } 953 }
972   954  
973 #endregion 955 #endregion
974 } -  
975   -  
976 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, -  
977 AllowMultiple = true)] -  
978 public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute -  
979 { 956  
980 #region Public Enums, Properties and Fields -  
981   957 #region Public Enums, Properties and Fields
982 [NotNull] 958  
-   959 [NotNull] public string Format { get; }
-   960  
-   961 #endregion
-   962 }
-   963  
983 public string Format { get; } 964 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
984   965 AllowMultiple = true)]
985 #endregion 966 public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
986   967 {
987 #region Constructors, Destructors and Finalizers 968 #region Constructors, Destructors and Finalizers
988   969  
989 public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) 970 public AspMvcAreaViewLocationFormatAttribute([NotNull] string format)
990 { 971 {
991 Format = format; 972 Format = format;
992 } 973 }
993   974  
994 #endregion 975 #endregion
995 } -  
996   -  
997 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, -  
998 AllowMultiple = true)] -  
999 public sealed class AspMvcMasterLocationFormatAttribute : Attribute -  
1000 { 976  
1001 #region Public Enums, Properties and Fields -  
1002   977 #region Public Enums, Properties and Fields
1003 [NotNull] 978  
-   979 [NotNull] public string Format { get; }
-   980  
-   981 #endregion
-   982 }
-   983  
1004 public string Format { get; } 984 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1005   985 AllowMultiple = true)]
1006 #endregion 986 public sealed class AspMvcMasterLocationFormatAttribute : Attribute
1007   987 {
1008 #region Constructors, Destructors and Finalizers 988 #region Constructors, Destructors and Finalizers
1009   989  
1010 public AspMvcMasterLocationFormatAttribute([NotNull] string format) 990 public AspMvcMasterLocationFormatAttribute([NotNull] string format)
1011 { 991 {
1012 Format = format; 992 Format = format;
1013 } 993 }
1014   994  
1015 #endregion 995 #endregion
1016 } -  
1017   -  
1018 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, -  
1019 AllowMultiple = true)] -  
1020 public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute -  
1021 { 996  
1022 #region Public Enums, Properties and Fields -  
1023   997 #region Public Enums, Properties and Fields
1024 [NotNull] 998  
-   999 [NotNull] public string Format { get; }
-   1000  
-   1001 #endregion
-   1002 }
-   1003  
1025 public string Format { get; } 1004 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1026   1005 AllowMultiple = true)]
1027 #endregion 1006 public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
1028   1007 {
1029 #region Constructors, Destructors and Finalizers 1008 #region Constructors, Destructors and Finalizers
1030   1009  
1031 public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) 1010 public AspMvcPartialViewLocationFormatAttribute([NotNull] string format)
1032 { 1011 {
1033 Format = format; 1012 Format = format;
1034 } 1013 }
1035   1014  
1036 #endregion 1015 #endregion
1037 } -  
1038   -  
1039 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, -  
1040 AllowMultiple = true)] -  
1041 public sealed class AspMvcViewLocationFormatAttribute : Attribute -  
1042 { 1016  
1043 #region Public Enums, Properties and Fields -  
1044   1017 #region Public Enums, Properties and Fields
1045 [NotNull] 1018  
-   1019 [NotNull] public string Format { get; }
-   1020  
-   1021 #endregion
-   1022 }
-   1023  
1046 public string Format { get; } 1024 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1047   1025 AllowMultiple = true)]
1048 #endregion 1026 public sealed class AspMvcViewLocationFormatAttribute : Attribute
1049   1027 {
1050 #region Constructors, Destructors and Finalizers 1028 #region Constructors, Destructors and Finalizers
1051   1029  
1052 public AspMvcViewLocationFormatAttribute([NotNull] string format) 1030 public AspMvcViewLocationFormatAttribute([NotNull] string format)
1053 { 1031 {
1054 Format = format; 1032 Format = format;
1055 } 1033 }
1056   1034  
1057 #endregion 1035 #endregion
-   1036  
-   1037 #region Public Enums, Properties and Fields
-   1038  
-   1039 [NotNull] public string Format { get; }
-   1040  
-   1041 #endregion
1058 } 1042 }
1059   1043  
1060 /// <summary> 1044 /// <summary>
1061 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 1045 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1062 /// is an MVC action. If applied to a method, the MVC action name is calculated 1046 /// is an MVC action. If applied to a method, the MVC action name is calculated
1063 /// implicitly from the context. Use this attribute for custom wrappers similar to 1047 /// implicitly from the context. Use this attribute for custom wrappers similar to
1064 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. 1048 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
1065 /// </summary> 1049 /// </summary>
1066 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | 1050 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1067 AttributeTargets.Property)] 1051 AttributeTargets.Property)]
1068 public sealed class AspMvcActionAttribute : Attribute 1052 public sealed class AspMvcActionAttribute : Attribute
1069 { 1053 {
1070 #region Public Enums, Properties and Fields 1054 #region Public Enums, Properties and Fields
1071   -  
1072 [CanBeNull] 1055  
1073 public string AnonymousProperty { get; } 1056 [CanBeNull] public string AnonymousProperty { get; }
1074   1057  
1075 #endregion 1058 #endregion
1076   1059  
1077 #region Constructors, Destructors and Finalizers 1060 #region Constructors, Destructors and Finalizers
1078   1061  
1079 public AspMvcActionAttribute() 1062 public AspMvcActionAttribute()
1080 { 1063 {
1081 } 1064 }
1082   1065  
1083 public AspMvcActionAttribute([NotNull] string anonymousProperty) 1066 public AspMvcActionAttribute([NotNull] string anonymousProperty)
1084 { 1067 {
1085 AnonymousProperty = anonymousProperty; 1068 AnonymousProperty = anonymousProperty;
1086 } 1069 }
1087   1070  
1088 #endregion 1071 #endregion
1089 } 1072 }
1090   1073  
1091 /// <summary> 1074 /// <summary>
1092 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area. 1075 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area.
1093 /// Use this attribute for custom wrappers similar to 1076 /// Use this attribute for custom wrappers similar to
1094 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. 1077 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
1095 /// </summary> 1078 /// </summary>
1096 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1079 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1097 public sealed class AspMvcAreaAttribute : Attribute 1080 public sealed class AspMvcAreaAttribute : Attribute
1098 { 1081 {
1099 #region Public Enums, Properties and Fields 1082 #region Public Enums, Properties and Fields
1100   -  
1101 [CanBeNull] 1083  
1102 public string AnonymousProperty { get; } 1084 [CanBeNull] public string AnonymousProperty { get; }
1103   1085  
1104 #endregion 1086 #endregion
1105   1087  
1106 #region Constructors, Destructors and Finalizers 1088 #region Constructors, Destructors and Finalizers
1107   1089  
1108 public AspMvcAreaAttribute() 1090 public AspMvcAreaAttribute()
1109 { 1091 {
1110 } 1092 }
1111   1093  
1112 public AspMvcAreaAttribute([NotNull] string anonymousProperty) 1094 public AspMvcAreaAttribute([NotNull] string anonymousProperty)
1113 { 1095 {
1114 AnonymousProperty = anonymousProperty; 1096 AnonymousProperty = anonymousProperty;
1115 } 1097 }
1116   1098  
1117 #endregion 1099 #endregion
1118 } 1100 }
1119   1101  
1120 /// <summary> 1102 /// <summary>
1121 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is 1103 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
1122 /// an MVC controller. If applied to a method, the MVC controller name is calculated 1104 /// an MVC controller. If applied to a method, the MVC controller name is calculated
1123 /// implicitly from the context. Use this attribute for custom wrappers similar to 1105 /// implicitly from the context. Use this attribute for custom wrappers similar to
1124 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>. 1106 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>.
1125 /// </summary> 1107 /// </summary>
1126 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | 1108 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1127 AttributeTargets.Property)] 1109 AttributeTargets.Property)]
1128 public sealed class AspMvcControllerAttribute : Attribute 1110 public sealed class AspMvcControllerAttribute : Attribute
1129 { 1111 {
1130 #region Public Enums, Properties and Fields 1112 #region Public Enums, Properties and Fields
1131   -  
1132 [CanBeNull] 1113  
1133 public string AnonymousProperty { get; } 1114 [CanBeNull] public string AnonymousProperty { get; }
1134   1115  
1135 #endregion 1116 #endregion
1136   1117  
1137 #region Constructors, Destructors and Finalizers 1118 #region Constructors, Destructors and Finalizers
1138   1119  
1139 public AspMvcControllerAttribute() 1120 public AspMvcControllerAttribute()
1140 { 1121 {
1141 } 1122 }
1142   1123  
1143 public AspMvcControllerAttribute([NotNull] string anonymousProperty) 1124 public AspMvcControllerAttribute([NotNull] string anonymousProperty)
1144 { 1125 {
1145 AnonymousProperty = anonymousProperty; 1126 AnonymousProperty = anonymousProperty;
1146 } 1127 }
1147   1128  
1148 #endregion 1129 #endregion
1149 } 1130 }
1150   1131  
1151 /// <summary> 1132 /// <summary>
1152 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute 1133 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute
1153 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>. 1134 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>.
1154 /// </summary> 1135 /// </summary>
1155 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1136 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1156 public sealed class AspMvcMasterAttribute : Attribute 1137 public sealed class AspMvcMasterAttribute : Attribute
1157 { 1138 {
1158 } 1139 }
1159   1140  
1160 /// <summary> 1141 /// <summary>
1161 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute 1142 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute
1162 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>. 1143 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>.
1163 /// </summary> 1144 /// </summary>
1164 [AttributeUsage(AttributeTargets.Parameter)] 1145 [AttributeUsage(AttributeTargets.Parameter)]
1165 public sealed class AspMvcModelTypeAttribute : Attribute 1146 public sealed class AspMvcModelTypeAttribute : Attribute
1166 { 1147 {
1167 } 1148 }
1168   1149  
1169 /// <summary> 1150 /// <summary>
1170 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC 1151 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
1171 /// partial view. If applied to a method, the MVC partial view name is calculated implicitly 1152 /// partial view. If applied to a method, the MVC partial view name is calculated implicitly
1172 /// from the context. Use this attribute for custom wrappers similar to 1153 /// from the context. Use this attribute for custom wrappers similar to
1173 /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>. 1154 /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>.
1174 /// </summary> 1155 /// </summary>
1175 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | 1156 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1176 AttributeTargets.Property)] 1157 AttributeTargets.Property)]
1177 public sealed class AspMvcPartialViewAttribute : Attribute 1158 public sealed class AspMvcPartialViewAttribute : Attribute
1178 { 1159 {
1179 } 1160 }
1180   1161  
1181 /// <summary> 1162 /// <summary>
1182 /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. 1163 /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method.
1183 /// </summary> 1164 /// </summary>
1184 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 1165 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
1185 public sealed class AspMvcSuppressViewErrorAttribute : Attribute 1166 public sealed class AspMvcSuppressViewErrorAttribute : Attribute
1186 { 1167 {
1187 } 1168 }
1188   1169  
1189 /// <summary> 1170 /// <summary>
1190 /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. 1171 /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
1191 /// Use this attribute for custom wrappers similar to 1172 /// Use this attribute for custom wrappers similar to
1192 /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>. 1173 /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>.
1193 /// </summary> 1174 /// </summary>
1194 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1175 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1195 public sealed class AspMvcDisplayTemplateAttribute : Attribute 1176 public sealed class AspMvcDisplayTemplateAttribute : Attribute
1196 { 1177 {
1197 } 1178 }
1198   1179  
1199 /// <summary> 1180 /// <summary>
1200 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template. 1181 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template.
1201 /// Use this attribute for custom wrappers similar to 1182 /// Use this attribute for custom wrappers similar to
1202 /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>. 1183 /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>.
1203 /// </summary> 1184 /// </summary>
1204 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1185 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1205 public sealed class AspMvcEditorTemplateAttribute : Attribute 1186 public sealed class AspMvcEditorTemplateAttribute : Attribute
1206 { 1187 {
1207 } 1188 }
1208   1189  
1209 /// <summary> 1190 /// <summary>
1210 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template. 1191 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template.
1211 /// Use this attribute for custom wrappers similar to 1192 /// Use this attribute for custom wrappers similar to
1212 /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>. 1193 /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>.
1213 /// </summary> 1194 /// </summary>
1214 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1195 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1215 public sealed class AspMvcTemplateAttribute : Attribute 1196 public sealed class AspMvcTemplateAttribute : Attribute
1216 { 1197 {
1217 } 1198 }
1218   1199  
1219 /// <summary> 1200 /// <summary>
1220 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 1201 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1221 /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly 1202 /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly
1222 /// from the context. Use this attribute for custom wrappers similar to 1203 /// from the context. Use this attribute for custom wrappers similar to
1223 /// <c>System.Web.Mvc.Controller.View(Object)</c>. 1204 /// <c>System.Web.Mvc.Controller.View(Object)</c>.
1224 /// </summary> 1205 /// </summary>
1225 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | 1206 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1226 AttributeTargets.Property)] 1207 AttributeTargets.Property)]
1227 public sealed class AspMvcViewAttribute : Attribute 1208 public sealed class AspMvcViewAttribute : Attribute
1228 { 1209 {
1229 } 1210 }
1230   1211  
1231 /// <summary> 1212 /// <summary>
1232 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 1213 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1233 /// is an MVC view component name. 1214 /// is an MVC view component name.
1234 /// </summary> 1215 /// </summary>
1235 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1216 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1236 public sealed class AspMvcViewComponentAttribute : Attribute 1217 public sealed class AspMvcViewComponentAttribute : Attribute
1237 { 1218 {
1238 } 1219 }
1239   1220  
1240 /// <summary> 1221 /// <summary>
1241 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 1222 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1242 /// is an MVC view component view. If applied to a method, the MVC view component view name is default. 1223 /// is an MVC view component view. If applied to a method, the MVC view component view name is default.
1243 /// </summary> 1224 /// </summary>
1244 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field | 1225 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1245 AttributeTargets.Property)] 1226 AttributeTargets.Property)]
1246 public sealed class AspMvcViewComponentViewAttribute : Attribute 1227 public sealed class AspMvcViewComponentViewAttribute : Attribute
1247 { 1228 {
1248 } 1229 }
1249   1230  
1250 /// <summary> 1231 /// <summary>
1251 /// ASP.NET MVC attribute. When applied to a parameter of an attribute, 1232 /// ASP.NET MVC attribute. When applied to a parameter of an attribute,
1252 /// indicates that this parameter is an MVC action name. 1233 /// indicates that this parameter is an MVC action name.
1253 /// </summary> 1234 /// </summary>
1254 /// <example> 1235 /// <example>
1255 /// <code> 1236 /// <code>
1256 /// [ActionName("Foo")] 1237 /// [ActionName("Foo")]
1257 /// public ActionResult Login(string returnUrl) { 1238 /// public ActionResult Login(string returnUrl) {
1258 /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK 1239 /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
1259 /// return RedirectToAction("Bar"); // Error: Cannot resolve action 1240 /// return RedirectToAction("Bar"); // Error: Cannot resolve action
1260 /// } 1241 /// }
1261 /// </code> 1242 /// </code>
1262 /// </example> 1243 /// </example>
1263 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] 1244 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
1264 public sealed class AspMvcActionSelectorAttribute : Attribute 1245 public sealed class AspMvcActionSelectorAttribute : Attribute
1265 { 1246 {
1266 } 1247 }
1267   1248  
1268 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] 1249 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
1269 public sealed class HtmlElementAttributesAttribute : Attribute 1250 public sealed class HtmlElementAttributesAttribute : Attribute
1270 { 1251 {
1271 #region Public Enums, Properties and Fields 1252 #region Public Enums, Properties and Fields
1272   -  
1273 [CanBeNull] 1253  
1274 public string Name { get; } 1254 [CanBeNull] public string Name { get; }
1275   1255  
1276 #endregion 1256 #endregion
1277   1257  
1278 #region Constructors, Destructors and Finalizers 1258 #region Constructors, Destructors and Finalizers
1279   1259  
1280 public HtmlElementAttributesAttribute() 1260 public HtmlElementAttributesAttribute()
1281 { 1261 {
1282 } 1262 }
1283   1263  
1284 public HtmlElementAttributesAttribute([NotNull] string name) 1264 public HtmlElementAttributesAttribute([NotNull] string name)
1285 { 1265 {
1286 Name = name; 1266 Name = name;
1287 } 1267 }
1288   1268  
1289 #endregion 1269 #endregion
1290 } 1270 }
1291   1271  
1292 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1272 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1293 public sealed class HtmlAttributeValueAttribute : Attribute 1273 public sealed class HtmlAttributeValueAttribute : Attribute
1294 { 1274 {
1295 #region Public Enums, Properties and Fields -  
1296   -  
1297 [NotNull] -  
1298 public string Name { get; } -  
1299   -  
1300 #endregion -  
1301   -  
1302 #region Constructors, Destructors and Finalizers 1275 #region Constructors, Destructors and Finalizers
1303   1276  
1304 public HtmlAttributeValueAttribute([NotNull] string name) 1277 public HtmlAttributeValueAttribute([NotNull] string name)
1305 { 1278 {
1306 Name = name; 1279 Name = name;
1307 } 1280 }
1308   1281  
1309 #endregion 1282 #endregion
-   1283  
-   1284 #region Public Enums, Properties and Fields
-   1285  
-   1286 [NotNull] public string Name { get; }
-   1287  
-   1288 #endregion
1310 } 1289 }
1311   1290  
1312 /// <summary> 1291 /// <summary>
1313 /// Razor attribute. Indicates that the marked parameter or method is a Razor section. 1292 /// Razor attribute. Indicates that the marked parameter or method is a Razor section.
1314 /// Use this attribute for custom wrappers similar to 1293 /// Use this attribute for custom wrappers similar to
1315 /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>. 1294 /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>.
1316 /// </summary> 1295 /// </summary>
1317 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 1296 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
1318 public sealed class RazorSectionAttribute : Attribute 1297 public sealed class RazorSectionAttribute : Attribute
1319 { 1298 {
1320 } 1299 }
1321   1300  
1322 /// <summary> 1301 /// <summary>
1323 /// Indicates how method, constructor invocation, or property access 1302 /// Indicates how method, constructor invocation, or property access
1324 /// over collection type affects the contents of the collection. 1303 /// over collection type affects the contents of the collection.
1325 /// Use <see cref="CollectionAccessType" /> to specify the access type. 1304 /// Use <see cref="CollectionAccessType" /> to specify the access type.
1326 /// </summary> 1305 /// </summary>
1327 /// <remarks> 1306 /// <remarks>
1328 /// Using this attribute only makes sense if all collection methods are marked with this attribute. 1307 /// Using this attribute only makes sense if all collection methods are marked with this attribute.
1329 /// </remarks> 1308 /// </remarks>
1330 /// <example> 1309 /// <example>
1331 /// <code> 1310 /// <code>
1332 /// public class MyStringCollection : List&lt;string&gt; 1311 /// public class MyStringCollection : List&lt;string&gt;
1333 /// { 1312 /// {
1334 /// [CollectionAccess(CollectionAccessType.Read)] 1313 /// [CollectionAccess(CollectionAccessType.Read)]
1335 /// public string GetFirstString() 1314 /// public string GetFirstString()
1336 /// { 1315 /// {
1337 /// return this.ElementAt(0); 1316 /// return this.ElementAt(0);
1338 /// } 1317 /// }
1339 /// } 1318 /// }
1340 /// class Test 1319 /// class Test
1341 /// { 1320 /// {
1342 /// public void Foo() 1321 /// public void Foo()
1343 /// { 1322 /// {
1344 /// // Warning: Contents of the collection is never updated 1323 /// // Warning: Contents of the collection is never updated
1345 /// var col = new MyStringCollection(); 1324 /// var col = new MyStringCollection();
1346 /// string x = col.GetFirstString(); 1325 /// string x = col.GetFirstString();
1347 /// } 1326 /// }
1348 /// } 1327 /// }
1349 /// </code> 1328 /// </code>
1350 /// </example> 1329 /// </example>
1351 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] 1330 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)]
1352 public sealed class CollectionAccessAttribute : Attribute 1331 public sealed class CollectionAccessAttribute : Attribute
1353 { 1332 {
1354 #region Public Enums, Properties and Fields -  
1355   -  
1356 public CollectionAccessType CollectionAccessType { get; } -  
1357   -  
1358 #endregion -  
1359   -  
1360 #region Constructors, Destructors and Finalizers 1333 #region Constructors, Destructors and Finalizers
1361   1334  
1362 public CollectionAccessAttribute(CollectionAccessType collectionAccessType) 1335 public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
1363 { 1336 {
1364 CollectionAccessType = collectionAccessType; 1337 CollectionAccessType = collectionAccessType;
1365 } 1338 }
1366   1339  
1367 #endregion 1340 #endregion
-   1341  
-   1342 #region Public Enums, Properties and Fields
-   1343  
-   1344 public CollectionAccessType CollectionAccessType { get; }
-   1345  
-   1346 #endregion
1368 } 1347 }
1369   1348  
1370 /// <summary> 1349 /// <summary>
1371 /// Provides a value for the <see cref="CollectionAccessAttribute" /> to define 1350 /// Provides a value for the <see cref="CollectionAccessAttribute" /> to define
1372 /// how the collection method invocation affects the contents of the collection. 1351 /// how the collection method invocation affects the contents of the collection.
1373 /// </summary> 1352 /// </summary>
1374 [Flags] 1353 [Flags]
1375 public enum CollectionAccessType 1354 public enum CollectionAccessType
1376 { 1355 {
1377 /// <summary>Method does not use or modify content of the collection.</summary> 1356 /// <summary>Method does not use or modify content of the collection.</summary>
1378 None = 0, 1357 None = 0,
1379   1358  
1380 /// <summary>Method only reads content of the collection but does not modify it.</summary> 1359 /// <summary>Method only reads content of the collection but does not modify it.</summary>
1381 Read = 1, 1360 Read = 1,
1382   1361  
1383 /// <summary>Method can change content of the collection but does not add new elements.</summary> 1362 /// <summary>Method can change content of the collection but does not add new elements.</summary>
1384 ModifyExistingContent = 2, 1363 ModifyExistingContent = 2,
1385   1364  
1386 /// <summary>Method can add new elements to the collection.</summary> 1365 /// <summary>Method can add new elements to the collection.</summary>
1387 UpdatedContent = ModifyExistingContent | 4 1366 UpdatedContent = ModifyExistingContent | 4
1388 } 1367 }
1389   1368  
1390 /// <summary> 1369 /// <summary>
1391 /// Indicates that the marked method is assertion method, i.e. it halts the control flow if 1370 /// Indicates that the marked method is assertion method, i.e. it halts the control flow if
1392 /// one of the conditions is satisfied. To set the condition, mark one of the parameters with 1371 /// one of the conditions is satisfied. To set the condition, mark one of the parameters with
1393 /// <see cref="AssertionConditionAttribute" /> attribute. 1372 /// <see cref="AssertionConditionAttribute" /> attribute.
1394 /// </summary> 1373 /// </summary>
1395 [AttributeUsage(AttributeTargets.Method)] 1374 [AttributeUsage(AttributeTargets.Method)]
1396 public sealed class AssertionMethodAttribute : Attribute 1375 public sealed class AssertionMethodAttribute : Attribute
1397 { 1376 {
1398 } 1377 }
1399   1378  
1400 /// <summary> 1379 /// <summary>
1401 /// Indicates the condition parameter of the assertion method. The method itself should be 1380 /// Indicates the condition parameter of the assertion method. The method itself should be
1402 /// marked by <see cref="AssertionMethodAttribute" /> attribute. The mandatory argument of 1381 /// marked by <see cref="AssertionMethodAttribute" /> attribute. The mandatory argument of
1403 /// the attribute is the assertion type. 1382 /// the attribute is the assertion type.
1404 /// </summary> 1383 /// </summary>
1405 [AttributeUsage(AttributeTargets.Parameter)] 1384 [AttributeUsage(AttributeTargets.Parameter)]
1406 public sealed class AssertionConditionAttribute : Attribute 1385 public sealed class AssertionConditionAttribute : Attribute
1407 { 1386 {
1408 #region Public Enums, Properties and Fields -  
1409   -  
1410 public AssertionConditionType ConditionType { get; } -  
1411   -  
1412 #endregion -  
1413   -  
1414 #region Constructors, Destructors and Finalizers 1387 #region Constructors, Destructors and Finalizers
1415   1388  
1416 public AssertionConditionAttribute(AssertionConditionType conditionType) 1389 public AssertionConditionAttribute(AssertionConditionType conditionType)
1417 { 1390 {
1418 ConditionType = conditionType; 1391 ConditionType = conditionType;
1419 } 1392 }
1420   1393  
1421 #endregion 1394 #endregion
-   1395  
-   1396 #region Public Enums, Properties and Fields
-   1397  
-   1398 public AssertionConditionType ConditionType { get; }
-   1399  
-   1400 #endregion
1422 } 1401 }
1423   1402  
1424 /// <summary> 1403 /// <summary>
1425 /// Specifies assertion type. If the assertion method argument satisfies the condition, 1404 /// Specifies assertion type. If the assertion method argument satisfies the condition,
1426 /// then the execution continues. Otherwise, execution is assumed to be halted. 1405 /// then the execution continues. Otherwise, execution is assumed to be halted.
1427 /// </summary> 1406 /// </summary>
1428 public enum AssertionConditionType 1407 public enum AssertionConditionType
1429 { 1408 {
1430 /// <summary>Marked parameter should be evaluated to true.</summary> 1409 /// <summary>Marked parameter should be evaluated to true.</summary>
1431 IS_TRUE = 0, 1410 IS_TRUE = 0,
1432   1411  
1433 /// <summary>Marked parameter should be evaluated to false.</summary> 1412 /// <summary>Marked parameter should be evaluated to false.</summary>
1434 IS_FALSE = 1, 1413 IS_FALSE = 1,
1435   1414  
1436 /// <summary>Marked parameter should be evaluated to null value.</summary> 1415 /// <summary>Marked parameter should be evaluated to null value.</summary>
1437 IS_NULL = 2, 1416 IS_NULL = 2,
1438   1417  
1439 /// <summary>Marked parameter should be evaluated to not null value.</summary> 1418 /// <summary>Marked parameter should be evaluated to not null value.</summary>
1440 IS_NOT_NULL = 3 1419 IS_NOT_NULL = 3
1441 } 1420 }
1442   1421  
1443 /// <summary> 1422 /// <summary>
1444 /// Indicates that the marked method unconditionally terminates control flow execution. 1423 /// Indicates that the marked method unconditionally terminates control flow execution.
1445 /// For example, it could unconditionally throw exception. 1424 /// For example, it could unconditionally throw exception.
1446 /// </summary> 1425 /// </summary>
1447 [Obsolete("Use [ContractAnnotation('=> halt')] instead")] 1426 [Obsolete("Use [ContractAnnotation('=> halt')] instead")]
1448 [AttributeUsage(AttributeTargets.Method)] 1427 [AttributeUsage(AttributeTargets.Method)]
1449 public sealed class TerminatesProgramAttribute : Attribute 1428 public sealed class TerminatesProgramAttribute : Attribute
1450 { 1429 {
1451 } 1430 }
1452   1431  
1453 /// <summary> 1432 /// <summary>
1454 /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, 1433 /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select,
1455 /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters 1434 /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
1456 /// of delegate type by analyzing LINQ method chains. 1435 /// of delegate type by analyzing LINQ method chains.
1457 /// </summary> 1436 /// </summary>
1458 [AttributeUsage(AttributeTargets.Method)] 1437 [AttributeUsage(AttributeTargets.Method)]
1459 public sealed class LinqTunnelAttribute : Attribute 1438 public sealed class LinqTunnelAttribute : Attribute
1460 { 1439 {
1461 } 1440 }
1462   1441  
1463 /// <summary> 1442 /// <summary>
1464 /// Indicates that IEnumerable passed as a parameter is not enumerated. 1443 /// Indicates that IEnumerable passed as a parameter is not enumerated.
1465 /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection. 1444 /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection.
1466 /// </summary> 1445 /// </summary>
1467 /// <example> 1446 /// <example>
1468 /// <code> 1447 /// <code>
1469 /// static void ThrowIfNull&lt;T&gt;([NoEnumeration] T v, string n) where T : class 1448 /// static void ThrowIfNull&lt;T&gt;([NoEnumeration] T v, string n) where T : class
1470 /// { 1449 /// {
1471 /// // custom check for null but no enumeration 1450 /// // custom check for null but no enumeration
1472 /// } 1451 /// }
1473 /// 1452 ///
1474 /// void Foo(IEnumerable&lt;string&gt; values) 1453 /// void Foo(IEnumerable&lt;string&gt; values)
1475 /// { 1454 /// {
1476 /// ThrowIfNull(values, nameof(values)); 1455 /// ThrowIfNull(values, nameof(values));
1477 /// var x = values.ToList(); // No warnings about multiple enumeration 1456 /// var x = values.ToList(); // No warnings about multiple enumeration
1478 /// } 1457 /// }
1479 /// </code> 1458 /// </code>
1480 /// </example> 1459 /// </example>
1481 [AttributeUsage(AttributeTargets.Parameter)] 1460 [AttributeUsage(AttributeTargets.Parameter)]
1482 public sealed class NoEnumerationAttribute : Attribute 1461 public sealed class NoEnumerationAttribute : Attribute
1483 { 1462 {
1484 } 1463 }
1485   1464  
1486 /// <summary> 1465 /// <summary>
1487 /// Indicates that the marked parameter is a regular expression pattern. 1466 /// Indicates that the marked parameter is a regular expression pattern.
1488 /// </summary> 1467 /// </summary>
1489 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 1468 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1490 public sealed class RegexPatternAttribute : Attribute 1469 public sealed class RegexPatternAttribute : Attribute
1491 { 1470 {
1492 } 1471 }
1493   1472  
1494 /// <summary> 1473 /// <summary>
1495 /// Prevents the Member Reordering feature from tossing members of the marked class. 1474 /// Prevents the Member Reordering feature from tossing members of the marked class.
1496 /// </summary> 1475 /// </summary>
1497 /// <remarks> 1476 /// <remarks>
1498 /// The attribute must be mentioned in your member reordering patterns. 1477 /// The attribute must be mentioned in your member reordering patterns.
1499 /// </remarks> 1478 /// </remarks>
1500 [AttributeUsage( 1479 [AttributeUsage(
1501 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] 1480 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)]
1502 public sealed class NoReorderAttribute : Attribute 1481 public sealed class NoReorderAttribute : Attribute
1503 { 1482 {
1504 } 1483 }
1505   1484  
1506 /// <summary> 1485 /// <summary>
1507 /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated 1486 /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated
1508 /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve. 1487 /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve.
1509 /// </summary> 1488 /// </summary>
1510 [AttributeUsage(AttributeTargets.Class)] 1489 [AttributeUsage(AttributeTargets.Class)]
1511 public sealed class XamlItemsControlAttribute : Attribute 1490 public sealed class XamlItemsControlAttribute : Attribute
1512 { 1491 {
1513 } 1492 }
1514   1493  
1515 /// <summary> 1494 /// <summary>
1516 /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that 1495 /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that
1517 /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will 1496 /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
1518 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. 1497 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
1519 /// </summary> 1498 /// </summary>
1520 /// <remarks> 1499 /// <remarks>
1521 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or 1500 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or
1522 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. 1501 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute.
1523 /// </remarks> 1502 /// </remarks>
1524 [AttributeUsage(AttributeTargets.Property)] 1503 [AttributeUsage(AttributeTargets.Property)]
1525 public sealed class XamlItemBindingOfItemsControlAttribute : Attribute 1504 public sealed class XamlItemBindingOfItemsControlAttribute : Attribute
1526 { 1505 {
1527 } 1506 }
1528   1507  
1529 /// <summary> 1508 /// <summary>
1530 /// XAML attribute. Indicates the property of some <c>Style</c>-derived type, that 1509 /// XAML attribute. Indicates the property of some <c>Style</c>-derived type, that
1531 /// is used to style items of <c>ItemsControl</c>-derived type. This annotation will 1510 /// is used to style items of <c>ItemsControl</c>-derived type. This annotation will
1532 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. 1511 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
1533 /// </summary> 1512 /// </summary>
1534 /// <remarks> 1513 /// <remarks>
1535 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or 1514 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or
1536 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute. 1515 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute.
1537 /// </remarks> 1516 /// </remarks>
1538 [AttributeUsage(AttributeTargets.Property)] 1517 [AttributeUsage(AttributeTargets.Property)]
1539 public sealed class XamlItemStyleOfItemsControlAttribute : Attribute 1518 public sealed class XamlItemStyleOfItemsControlAttribute : Attribute
1540 { 1519 {
1541 } 1520 }
1542   1521  
1543 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 1522 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
1544 public sealed class AspChildControlTypeAttribute : Attribute 1523 public sealed class AspChildControlTypeAttribute : Attribute
1545 { 1524 {
1546 #region Public Enums, Properties and Fields -  
1547   -  
1548 [NotNull] -  
1549 public string TagName { get; } -  
1550   -  
1551 [NotNull] -  
1552 public Type ControlType { get; } -  
1553   -  
1554 #endregion -  
1555   -  
1556 #region Constructors, Destructors and Finalizers 1525 #region Constructors, Destructors and Finalizers
1557   1526  
1558 public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) 1527 public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType)
1559 { 1528 {
1560 TagName = tagName; 1529 TagName = tagName;
1561 ControlType = controlType; 1530 ControlType = controlType;
1562 } 1531 }
1563   1532  
1564 #endregion 1533 #endregion
-   1534  
-   1535 #region Public Enums, Properties and Fields
-   1536  
-   1537 [NotNull] public string TagName { get; }
-   1538  
-   1539 [NotNull] public Type ControlType { get; }
-   1540  
-   1541 #endregion
1565 } 1542 }
1566   1543  
1567 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 1544 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
1568 public sealed class AspDataFieldAttribute : Attribute 1545 public sealed class AspDataFieldAttribute : Attribute
1569 { 1546 {
1570 } 1547 }
1571   1548  
1572 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 1549 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
1573 public sealed class AspDataFieldsAttribute : Attribute 1550 public sealed class AspDataFieldsAttribute : Attribute
1574 { 1551 {
1575 } 1552 }
1576   1553  
1577 [AttributeUsage(AttributeTargets.Property)] 1554 [AttributeUsage(AttributeTargets.Property)]
1578 public sealed class AspMethodPropertyAttribute : Attribute 1555 public sealed class AspMethodPropertyAttribute : Attribute
1579 { 1556 {
1580 } 1557 }
1581   1558  
1582 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 1559 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
1583 public sealed class AspRequiredAttributeAttribute : Attribute 1560 public sealed class AspRequiredAttributeAttribute : Attribute
1584 { 1561 {
1585 #region Public Enums, Properties and Fields -  
1586   -  
1587 [NotNull] -  
1588 public string Attribute { get; } -  
1589   -  
1590 #endregion -  
1591   -  
1592 #region Constructors, Destructors and Finalizers 1562 #region Constructors, Destructors and Finalizers
1593   1563  
1594 public AspRequiredAttributeAttribute([NotNull] string attribute) 1564 public AspRequiredAttributeAttribute([NotNull] string attribute)
1595 { 1565 {
1596 Attribute = attribute; 1566 Attribute = attribute;
1597 } 1567 }
1598   1568  
1599 #endregion 1569 #endregion
1600 } -  
1601   -  
1602 [AttributeUsage(AttributeTargets.Property)] -  
1603 public sealed class AspTypePropertyAttribute : Attribute -  
1604 { 1570  
1605 #region Public Enums, Properties and Fields 1571 #region Public Enums, Properties and Fields
1606   1572  
-   1573 [NotNull] public string Attribute { get; }
-   1574  
-   1575 #endregion
-   1576 }
1607 public bool CreateConstructorReferences { get; } 1577  
1608   1578 [AttributeUsage(AttributeTargets.Property)]
1609 #endregion 1579 public sealed class AspTypePropertyAttribute : Attribute
1610   1580 {
1611 #region Constructors, Destructors and Finalizers 1581 #region Constructors, Destructors and Finalizers
1612   1582  
1613 public AspTypePropertyAttribute(bool createConstructorReferences) 1583 public AspTypePropertyAttribute(bool createConstructorReferences)
1614 { 1584 {
1615 CreateConstructorReferences = createConstructorReferences; 1585 CreateConstructorReferences = createConstructorReferences;
1616 } 1586 }
1617   1587  
1618 #endregion 1588 #endregion
1619 } -  
1620   -  
1621 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -  
1622 public sealed class RazorImportNamespaceAttribute : Attribute -  
1623 { 1589  
1624 #region Public Enums, Properties and Fields -  
1625   1590 #region Public Enums, Properties and Fields
1626 [NotNull] 1591  
-   1592 public bool CreateConstructorReferences { get; }
-   1593  
-   1594 #endregion
-   1595 }
1627 public string Name { get; } 1596  
1628   1597 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1629 #endregion 1598 public sealed class RazorImportNamespaceAttribute : Attribute
1630   1599 {
1631 #region Constructors, Destructors and Finalizers 1600 #region Constructors, Destructors and Finalizers
1632   1601  
1633 public RazorImportNamespaceAttribute([NotNull] string name) 1602 public RazorImportNamespaceAttribute([NotNull] string name)
1634 { 1603 {
1635 Name = name; 1604 Name = name;
1636 } 1605 }
1637   1606  
1638 #endregion 1607 #endregion
1639 } -  
1640   -  
1641 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -  
1642 public sealed class RazorInjectionAttribute : Attribute -  
1643 { 1608  
1644 #region Public Enums, Properties and Fields -  
1645   1609 #region Public Enums, Properties and Fields
1646 [NotNull] -  
1647 public string Type { get; } -  
1648   -  
1649 [NotNull] 1610  
-   1611 [NotNull] public string Name { get; }
-   1612  
-   1613 #endregion
-   1614 }
1650 public string FieldName { get; } 1615  
1651   1616 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1652 #endregion 1617 public sealed class RazorInjectionAttribute : Attribute
1653   1618 {
1654 #region Constructors, Destructors and Finalizers 1619 #region Constructors, Destructors and Finalizers
1655   1620  
1656 public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) 1621 public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName)
1657 { 1622 {
1658 Type = type; 1623 Type = type;
1659 FieldName = fieldName; 1624 FieldName = fieldName;
1660 } 1625 }
1661   1626  
1662 #endregion 1627 #endregion
1663 } -  
1664   -  
1665 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -  
1666 public sealed class RazorDirectiveAttribute : Attribute -  
1667 { 1628  
1668 #region Public Enums, Properties and Fields 1629 #region Public Enums, Properties and Fields
-   1630  
1669   1631 [NotNull] public string Type { get; }
1670 [NotNull] 1632  
-   1633 [NotNull] public string FieldName { get; }
-   1634  
-   1635 #endregion
-   1636 }
1671 public string Directive { get; } 1637  
1672   1638 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1673 #endregion 1639 public sealed class RazorDirectiveAttribute : Attribute
1674   1640 {
1675 #region Constructors, Destructors and Finalizers 1641 #region Constructors, Destructors and Finalizers
1676   1642  
1677 public RazorDirectiveAttribute([NotNull] string directive) 1643 public RazorDirectiveAttribute([NotNull] string directive)
1678 { 1644 {
1679 Directive = directive; 1645 Directive = directive;
1680 } 1646 }
1681   1647  
1682 #endregion 1648 #endregion
-   1649  
-   1650 #region Public Enums, Properties and Fields
-   1651  
-   1652 [NotNull] public string Directive { get; }
-   1653  
-   1654 #endregion
1683 } 1655 }
1684   1656  
1685 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1657 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1686 public sealed class RazorPageBaseTypeAttribute : Attribute 1658 public sealed class RazorPageBaseTypeAttribute : Attribute
1687 { 1659 {
1688 #region Public Enums, Properties and Fields 1660 #region Public Enums, Properties and Fields
1689   -  
1690 [NotNull] 1661  
1691 public string BaseType { get; } -  
1692   1662 [NotNull] public string BaseType { get; }
1693 [CanBeNull] 1663  
1694 public string PageName { get; } 1664 [CanBeNull] public string PageName { get; }
1695   1665  
1696 #endregion 1666 #endregion
1697   1667  
1698 #region Constructors, Destructors and Finalizers 1668 #region Constructors, Destructors and Finalizers
1699   1669  
1700 public RazorPageBaseTypeAttribute([NotNull] string baseType) 1670 public RazorPageBaseTypeAttribute([NotNull] string baseType)
1701 { 1671 {
1702 BaseType = baseType; 1672 BaseType = baseType;
1703 } 1673 }
1704   1674  
1705 public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) 1675 public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName)
1706 { 1676 {
1707 BaseType = baseType; 1677 BaseType = baseType;
1708 PageName = pageName; 1678 PageName = pageName;
1709 } 1679 }
1710   1680  
1711 #endregion 1681 #endregion
1712 } 1682 }
1713   1683  
1714 [AttributeUsage(AttributeTargets.Method)] 1684 [AttributeUsage(AttributeTargets.Method)]
1715 public sealed class RazorHelperCommonAttribute : Attribute 1685 public sealed class RazorHelperCommonAttribute : Attribute
1716 { 1686 {
1717 } 1687 }
1718   1688  
1719 [AttributeUsage(AttributeTargets.Property)] 1689 [AttributeUsage(AttributeTargets.Property)]
1720 public sealed class RazorLayoutAttribute : Attribute 1690 public sealed class RazorLayoutAttribute : Attribute
1721 { 1691 {
1722 } 1692 }
1723   1693  
1724 [AttributeUsage(AttributeTargets.Method)] 1694 [AttributeUsage(AttributeTargets.Method)]
1725 public sealed class RazorWriteLiteralMethodAttribute : Attribute 1695 public sealed class RazorWriteLiteralMethodAttribute : Attribute
1726 { 1696 {
1727 } 1697 }
1728   1698  
1729 [AttributeUsage(AttributeTargets.Method)] 1699 [AttributeUsage(AttributeTargets.Method)]
1730 public sealed class RazorWriteMethodAttribute : Attribute 1700 public sealed class RazorWriteMethodAttribute : Attribute
1731 { 1701 {
1732 } 1702 }
1733   1703  
1734 [AttributeUsage(AttributeTargets.Parameter)] 1704 [AttributeUsage(AttributeTargets.Parameter)]
1735 public sealed class RazorWriteMethodParameterAttribute : Attribute 1705 public sealed class RazorWriteMethodParameterAttribute : Attribute
1736 { 1706 {
1737 } 1707 }
1738 } 1708 }
1739   1709  
1740
Generated by GNU Enscript 1.6.5.90.
1710
Generated by GNU Enscript 1.6.5.90.
1741   1711  
1742   1712  
1743   1713