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