fx-sharp  0.1
A collection of functional extensions for C#.
 All Classes Namespaces Files Functions Variables Enumerator
JetBrains.Annotations.cs
Go to the documentation of this file.
1 using System;
2 
3 #pragma warning disable 1591
4 // ReSharper disable UnusedMember.Global
5 // ReSharper disable UnusedParameter.Local
6 // ReSharper disable MemberCanBePrivate.Global
7 // ReSharper disable UnusedAutoPropertyAccessor.Global
8 // ReSharper disable IntroduceOptionalParameters.Global
9 // ReSharper disable MemberCanBeProtected.Global
10 // ReSharper disable InconsistentNaming
11 // ReSharper disable CheckNamespace
12 
13 namespace JetBrains.Annotations
14 {
15  /// <summary>
16  /// Indicates that the value of the marked element could be <c>null</c> sometimes,
17  /// so the check for <c>null</c> is necessary before its usage
18  /// </summary>
19  /// <example><code>
20  /// [CanBeNull] public object Test() { return null; }
21  /// public void UseTest() {
22  /// var p = Test();
23  /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
24  /// }
25  /// </code></example>
26  [AttributeUsage(
27  AttributeTargets.Method | AttributeTargets.Parameter |
28  AttributeTargets.Property | AttributeTargets.Delegate |
29  AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
30  internal sealed class CanBeNullAttribute : Attribute { }
31 
32  /// <summary>
33  /// Indicates that the value of the marked element could never be <c>null</c>
34  /// </summary>
35  /// <example><code>
36  /// [NotNull] public object Foo() {
37  /// return null; // Warning: Possible 'null' assignment
38  /// }
39  /// </code></example>
40  [AttributeUsage(
41  AttributeTargets.Method | AttributeTargets.Parameter |
42  AttributeTargets.Property | AttributeTargets.Delegate |
43  AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
44  internal sealed class NotNullAttribute : Attribute { }
45 
46  /// <summary>
47  /// Indicates that the marked method builds string by format pattern and (optional) arguments.
48  /// Parameter, which contains format string, should be given in constructor. The format string
49  /// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form
50  /// </summary>
51  /// <example><code>
52  /// [StringFormatMethod("message")]
53  /// public void ShowError(string message, params object[] args) { /* do something */ }
54  /// public void Foo() {
55  /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
56  /// }
57  /// </code></example>
58  [AttributeUsage(
59  AttributeTargets.Constructor | AttributeTargets.Method,
60  AllowMultiple = false, Inherited = true)]
61  internal sealed class StringFormatMethodAttribute : Attribute
62  {
63  /// <param name="formatParameterName">
64  /// Specifies which parameter of an annotated method should be treated as format-string
65  /// </param>
66  public StringFormatMethodAttribute(string formatParameterName)
67  {
68  FormatParameterName = formatParameterName;
69  }
70 
71  public string FormatParameterName { get; private set; }
72  }
73 
74  /// <summary>
75  /// Indicates that the function argument should be string literal and match one
76  /// of the parameters of the caller function. For example, ReSharper annotates
77  /// the parameter of <see cref="System.ArgumentNullException"/>
78  /// </summary>
79  /// <example><code>
80  /// public void Foo(string param) {
81  /// if (param == null)
82  /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
83  /// }
84  /// </code></example>
85  [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
86  internal sealed class InvokerParameterNameAttribute : Attribute { }
87 
88  /// <summary>
89  /// Indicates that the method is contained in a type that implements
90  /// <see cref="System.ComponentModel.INotifyPropertyChanged"/> interface
91  /// and this method is used to notify that some property value changed
92  /// </summary>
93  /// <remarks>
94  /// The method should be non-static and conform to one of the supported signatures:
95  /// <list>
96  /// <item><c>NotifyChanged(string)</c></item>
97  /// <item><c>NotifyChanged(params string[])</c></item>
98  /// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
99  /// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
100  /// <item><c>SetProperty{T}(ref T, T, string)</c></item>
101  /// </list>
102  /// </remarks>
103  /// <example><code>
104  /// public class Foo : INotifyPropertyChanged {
105  /// public event PropertyChangedEventHandler PropertyChanged;
106  /// [NotifyPropertyChangedInvocator]
107  /// protected virtual void NotifyChanged(string propertyName) { ... }
108  ///
109  /// private string _name;
110  /// public string Name {
111  /// get { return _name; }
112  /// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
113  /// }
114  /// }
115  /// </code>
116  /// Examples of generated notifications:
117  /// <list>
118  /// <item><c>NotifyChanged("Property")</c></item>
119  /// <item><c>NotifyChanged(() =&gt; Property)</c></item>
120  /// <item><c>NotifyChanged((VM x) =&gt; x.Property)</c></item>
121  /// <item><c>SetProperty(ref myField, value, "Property")</c></item>
122  /// </list>
123  /// </example>
124  [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
125  internal sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
126  {
127  public NotifyPropertyChangedInvocatorAttribute() { }
128  public NotifyPropertyChangedInvocatorAttribute(string parameterName)
129  {
130  ParameterName = parameterName;
131  }
132 
133  public string ParameterName { get; private set; }
134  }
135 
136  /// <summary>
137  /// Describes dependency between method input and output
138  /// </summary>
139  /// <syntax>
140  /// <p>Function Definition Table syntax:</p>
141  /// <list>
142  /// <item>FDT ::= FDTRow [;FDTRow]*</item>
143  /// <item>FDTRow ::= Input =&gt; Output | Output &lt;= Input</item>
144  /// <item>Input ::= ParameterName: Value [, Input]*</item>
145  /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
146  /// <item>Value ::= true | false | null | notnull | canbenull</item>
147  /// </list>
148  /// If method has single input parameter, it's name could be omitted.<br/>
149  /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
150  /// for method output means that the methos doesn't return normally.<br/>
151  /// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
152  /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
153  /// or use single attribute with rows separated by semicolon.<br/>
154  /// </syntax>
155  /// <examples><list>
156  /// <item><code>
157  /// [ContractAnnotation("=> halt")]
158  /// public void TerminationMethod()
159  /// </code></item>
160  /// <item><code>
161  /// [ContractAnnotation("halt &lt;= condition: false")]
162  /// public void Assert(bool condition, string text) // regular assertion method
163  /// </code></item>
164  /// <item><code>
165  /// [ContractAnnotation("s:null => true")]
166  /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
167  /// </code></item>
168  /// <item><code>
169  /// // A method that returns null if the parameter is null, and not null if the parameter is not null
170  /// [ContractAnnotation("null => null; notnull => notnull")]
171  /// public object Transform(object data)
172  /// </code></item>
173  /// <item><code>
174  /// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
175  /// public bool TryParse(string s, out Person result)
176  /// </code></item>
177  /// </list></examples>
178  [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
179  internal sealed class ContractAnnotationAttribute : Attribute
180  {
181  public ContractAnnotationAttribute([NotNull] string contract)
182  : this(contract, false) { }
183 
184  public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
185  {
186  Contract = contract;
187  ForceFullStates = forceFullStates;
188  }
189 
190  public string Contract { get; private set; }
191  public bool ForceFullStates { get; private set; }
192  }
193 
194  /// <summary>
195  /// Indicates that marked element should be localized or not
196  /// </summary>
197  /// <example><code>
198  /// [LocalizationRequiredAttribute(true)]
199  /// public class Foo {
200  /// private string str = "my string"; // Warning: Localizable string
201  /// }
202  /// </code></example>
203  [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
204  internal sealed class LocalizationRequiredAttribute : Attribute
205  {
206  public LocalizationRequiredAttribute() : this(true) { }
207  public LocalizationRequiredAttribute(bool required)
208  {
209  Required = required;
210  }
211 
212  public bool Required { get; private set; }
213  }
214 
215  /// <summary>
216  /// Indicates that the value of the marked type (or its derivatives)
217  /// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
218  /// should be used instead. However, using '==' or '!=' for comparison
219  /// with <c>null</c> is always permitted.
220  /// </summary>
221  /// <example><code>
222  /// [CannotApplyEqualityOperator]
223  /// class NoEquality { }
224  /// class UsesNoEquality {
225  /// public void Test() {
226  /// var ca1 = new NoEquality();
227  /// var ca2 = new NoEquality();
228  /// if (ca1 != null) { // OK
229  /// bool condition = ca1 == ca2; // Warning
230  /// }
231  /// }
232  /// }
233  /// </code></example>
234  [AttributeUsage(
235  AttributeTargets.Interface | AttributeTargets.Class |
236  AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
237  internal sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
238 
239  /// <summary>
240  /// When applied to a target attribute, specifies a requirement for any type marked
241  /// with the target attribute to implement or inherit specific type or types.
242  /// </summary>
243  /// <example><code>
244  /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
245  /// public class ComponentAttribute : Attribute { }
246  /// [Component] // ComponentAttribute requires implementing IComponent interface
247  /// public class MyComponent : IComponent { }
248  /// </code></example>
249  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
250  [BaseTypeRequired(typeof(Attribute))]
251  internal sealed class BaseTypeRequiredAttribute : Attribute
252  {
253  public BaseTypeRequiredAttribute([NotNull] Type baseType)
254  {
255  BaseType = baseType;
256  }
257 
258  [NotNull]
259  public Type BaseType { get; private set; }
260  }
261 
262  /// <summary>
263  /// Indicates that the marked symbol is used implicitly
264  /// (e.g. via reflection, in external library), so this symbol
265  /// will not be marked as unused (as well as by other usage inspections)
266  /// </summary>
267  [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
268  internal sealed class UsedImplicitlyAttribute : Attribute
269  {
270  public UsedImplicitlyAttribute()
271  : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
272 
273  public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
274  : this(useKindFlags, ImplicitUseTargetFlags.Default) { }
275 
276  public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
277  : this(ImplicitUseKindFlags.Default, targetFlags) { }
278 
279  public UsedImplicitlyAttribute(
280  ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
281  {
282  UseKindFlags = useKindFlags;
283  TargetFlags = targetFlags;
284  }
285 
286  public ImplicitUseKindFlags UseKindFlags { get; private set; }
287  public ImplicitUseTargetFlags TargetFlags { get; private set; }
288  }
289 
290  /// <summary>
291  /// Should be used on attributes and causes ReSharper
292  /// to not mark symbols marked with such attributes as unused
293  /// (as well as by other usage inspections)
294  /// </summary>
295  [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
296  internal sealed class MeansImplicitUseAttribute : Attribute
297  {
298  public MeansImplicitUseAttribute()
299  : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
300 
301  public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
302  : this(useKindFlags, ImplicitUseTargetFlags.Default) { }
303 
304  public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
305  : this(ImplicitUseKindFlags.Default, targetFlags) { }
306 
307  public MeansImplicitUseAttribute(
308  ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
309  {
310  UseKindFlags = useKindFlags;
311  TargetFlags = targetFlags;
312  }
313 
314  [UsedImplicitly]
315  public ImplicitUseKindFlags UseKindFlags { get; private set; }
316  [UsedImplicitly]
317  public ImplicitUseTargetFlags TargetFlags { get; private set; }
318  }
319 
320  [Flags]
321  internal enum ImplicitUseKindFlags
322  {
324  /// <summary>Only entity marked with attribute considered used</summary>
325  Access = 1,
326  /// <summary>Indicates implicit assignment to a member</summary>
327  Assign = 2,
328  /// <summary>
329  /// Indicates implicit instantiation of a type with fixed constructor signature.
330  /// That means any unused constructor parameters won't be reported as such.
331  /// </summary>
333  /// <summary>Indicates implicit instantiation of a type</summary>
335  }
336 
337  /// <summary>
338  /// Specify what is considered used implicitly
339  /// when marked with <see cref="MeansImplicitUseAttribute"/>
340  /// or <see cref="UsedImplicitlyAttribute"/>
341  /// </summary>
342  [Flags]
343  internal enum ImplicitUseTargetFlags
344  {
345  Default = Itself,
346  Itself = 1,
347  /// <summary>Members of entity marked with attribute are considered used</summary>
348  Members = 2,
349  /// <summary>Entity marked with attribute and all its members considered used</summary>
350  WithMembers = Itself | Members
351  }
352 
353  /// <summary>
354  /// This attribute is intended to mark publicly available API
355  /// which should not be removed and so is treated as used
356  /// </summary>
357  [MeansImplicitUse]
358  internal sealed class PublicAPIAttribute : Attribute
359  {
360  public PublicAPIAttribute() { }
361  public PublicAPIAttribute([NotNull] string comment)
362  {
363  Comment = comment;
364  }
365 
366  [NotNull]
367  public string Comment { get; private set; }
368  }
369 
370  /// <summary>
371  /// Tells code analysis engine if the parameter is completely handled
372  /// when the invoked method is on stack. If the parameter is a delegate,
373  /// indicates that delegate is executed while the method is executed.
374  /// If the parameter is an enumerable, indicates that it is enumerated
375  /// while the method is executed
376  /// </summary>
377  [AttributeUsage(AttributeTargets.Parameter, Inherited = true)]
378  internal sealed class InstantHandleAttribute : Attribute { }
379 
380  /// <summary>
381  /// Indicates that a method does not make any observable state changes.
382  /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>
383  /// </summary>
384  /// <example><code>
385  /// [Pure] private int Multiply(int x, int y) { return x * y; }
386  /// public void Foo() {
387  /// const int a = 2, b = 2;
388  /// Multiply(a, b); // Waring: Return value of pure method is not used
389  /// }
390  /// </code></example>
391  [AttributeUsage(AttributeTargets.Method, Inherited = true)]
392  internal sealed class PureAttribute : Attribute { }
393 
394  /// <summary>
395  /// Indicates that a parameter is a path to a file or a folder
396  /// within a web project. Path can be relative or absolute,
397  /// starting from web root (~)
398  /// </summary>
399  [AttributeUsage(AttributeTargets.Parameter)]
400  internal class PathReferenceAttribute : Attribute
401  {
402  public PathReferenceAttribute() { }
403  public PathReferenceAttribute([PathReference] string basePath)
404  {
405  BasePath = basePath;
406  }
407 
408  [NotNull]
409  public string BasePath { get; private set; }
410  }
411 
412  // ASP.NET MVC attributes
413 
414  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
415  internal sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
416  {
417  public AspMvcAreaMasterLocationFormatAttribute(string format) { }
418  }
419 
420  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
421  internal sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
422  {
423  public AspMvcAreaPartialViewLocationFormatAttribute(string format) { }
424  }
425 
426  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
427  internal sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
428  {
429  public AspMvcAreaViewLocationFormatAttribute(string format) { }
430  }
431 
432  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
433  internal sealed class AspMvcMasterLocationFormatAttribute : Attribute
434  {
435  public AspMvcMasterLocationFormatAttribute(string format) { }
436  }
437 
438  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
439  internal sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
440  {
441  public AspMvcPartialViewLocationFormatAttribute(string format) { }
442  }
443 
444  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
445  internal sealed class AspMvcViewLocationFormatAttribute : Attribute
446  {
447  public AspMvcViewLocationFormatAttribute(string format) { }
448  }
449 
450  /// <summary>
451  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
452  /// is an MVC action. If applied to a method, the MVC action name is calculated
453  /// implicitly from the context. Use this attribute for custom wrappers similar to
454  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
455  /// </summary>
456  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
457  internal sealed class AspMvcActionAttribute : Attribute
458  {
459  public AspMvcActionAttribute() { }
460  public AspMvcActionAttribute([NotNull] string anonymousProperty)
461  {
462  AnonymousProperty = anonymousProperty;
463  }
464 
465  [NotNull]
466  public string AnonymousProperty { get; private set; }
467  }
468 
469  /// <summary>
470  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
471  /// Use this attribute for custom wrappers similar to
472  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>
473  /// </summary>
474  [AttributeUsage(AttributeTargets.Parameter)]
475  internal sealed class AspMvcAreaAttribute : PathReferenceAttribute
476  {
477  public AspMvcAreaAttribute() { }
478  public AspMvcAreaAttribute([NotNull] string anonymousProperty)
479  {
480  AnonymousProperty = anonymousProperty;
481  }
482 
483  [NotNull]
484  public string AnonymousProperty { get; private set; }
485  }
486 
487  /// <summary>
488  /// ASP.NET MVC attribute. If applied to a parameter, indicates that
489  /// the parameter is an MVC controller. If applied to a method,
490  /// the MVC controller name is calculated implicitly from the context.
491  /// Use this attribute for custom wrappers similar to
492  /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>
493  /// </summary>
494  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
495  internal sealed class AspMvcControllerAttribute : Attribute
496  {
497  public AspMvcControllerAttribute() { }
498  public AspMvcControllerAttribute([NotNull] string anonymousProperty)
499  {
500  AnonymousProperty = anonymousProperty;
501  }
502 
503  [NotNull]
504  public string AnonymousProperty { get; private set; }
505  }
506 
507  /// <summary>
508  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master.
509  /// Use this attribute for custom wrappers similar to
510  /// <c>System.Web.Mvc.Controller.View(String, String)</c>
511  /// </summary>
512  [AttributeUsage(AttributeTargets.Parameter)]
513  internal sealed class AspMvcMasterAttribute : Attribute { }
514 
515  /// <summary>
516  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type.
517  /// Use this attribute for custom wrappers similar to
518  /// <c>System.Web.Mvc.Controller.View(String, Object)</c>
519  /// </summary>
520  [AttributeUsage(AttributeTargets.Parameter)]
521  internal sealed class AspMvcModelTypeAttribute : Attribute { }
522 
523  /// <summary>
524  /// ASP.NET MVC attribute. If applied to a parameter, indicates that
525  /// the parameter is an MVC partial view. If applied to a method,
526  /// the MVC partial view name is calculated implicitly from the context.
527  /// Use this attribute for custom wrappers similar to
528  /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>
529  /// </summary>
530  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
531  internal sealed class AspMvcPartialViewAttribute : PathReferenceAttribute { }
532 
533  /// <summary>
534  /// ASP.NET MVC attribute. Allows disabling all inspections
535  /// for MVC views within a class or a method.
536  /// </summary>
537  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
538  internal sealed class AspMvcSupressViewErrorAttribute : Attribute { }
539 
540  /// <summary>
541  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
542  /// Use this attribute for custom wrappers similar to
543  /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>
544  /// </summary>
545  [AttributeUsage(AttributeTargets.Parameter)]
546  internal sealed class AspMvcDisplayTemplateAttribute : Attribute { }
547 
548  /// <summary>
549  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
550  /// Use this attribute for custom wrappers similar to
551  /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>
552  /// </summary>
553  [AttributeUsage(AttributeTargets.Parameter)]
554  internal sealed class AspMvcEditorTemplateAttribute : Attribute { }
555 
556  /// <summary>
557  /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
558  /// Use this attribute for custom wrappers similar to
559  /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>
560  /// </summary>
561  [AttributeUsage(AttributeTargets.Parameter)]
562  internal sealed class AspMvcTemplateAttribute : Attribute { }
563 
564  /// <summary>
565  /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
566  /// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
567  /// from the context. Use this attribute for custom wrappers similar to
568  /// <c>System.Web.Mvc.Controller.View(Object)</c>
569  /// </summary>
570  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
571  internal sealed class AspMvcViewAttribute : PathReferenceAttribute { }
572 
573  /// <summary>
574  /// ASP.NET MVC attribute. When applied to a parameter of an attribute,
575  /// indicates that this parameter is an MVC action name
576  /// </summary>
577  /// <example><code>
578  /// [ActionName("Foo")]
579  /// public ActionResult Login(string returnUrl) {
580  /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
581  /// return RedirectToAction("Bar"); // Error: Cannot resolve action
582  /// }
583  /// </code></example>
584  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
585  internal sealed class AspMvcActionSelectorAttribute : Attribute { }
586 
587  [AttributeUsage(
588  AttributeTargets.Parameter | AttributeTargets.Property |
589  AttributeTargets.Field, Inherited = true)]
590  internal sealed class HtmlElementAttributesAttribute : Attribute
591  {
592  public HtmlElementAttributesAttribute() { }
593  public HtmlElementAttributesAttribute([NotNull] string name)
594  {
595  Name = name;
596  }
597 
598  [NotNull]
599  public string Name { get; private set; }
600  }
601 
602  [AttributeUsage(
603  AttributeTargets.Parameter | AttributeTargets.Field |
604  AttributeTargets.Property, Inherited = true)]
605  internal sealed class HtmlAttributeValueAttribute : Attribute
606  {
607  public HtmlAttributeValueAttribute([NotNull] string name)
608  {
609  Name = name;
610  }
611 
612  [NotNull]
613  public string Name { get; private set; }
614  }
615 
616  // Razor attributes
617 
618  /// <summary>
619  /// Razor attribute. Indicates that a parameter or a method is a Razor section.
620  /// Use this attribute for custom wrappers similar to
621  /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>
622  /// </summary>
623  [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, Inherited = true)]
624  internal sealed class RazorSectionAttribute : Attribute { }
625 }
Indicates implicit instantiation of a type with fixed constructor signature. That means any unused co...
Indicates implicit instantiation of a type
Members of entity marked with attribute are considered used
Entity marked with attribute and all its members considered used
Only entity marked with attribute considered used
Indicates implicit assignment to a member