-
Notifications
You must be signed in to change notification settings - Fork 11
Annotate With
Michael Damatov edited this page Dec 15, 2024
·
10 revisions
Context action | When suggested | Applies to |
---|---|---|
Annotate with [AttributeUsage(...)]
|
class derives Attribute
|
types |
Annotate with [DefaultEqualityUsage]
|
type parameters, parameters, return values | |
Annotate with [HandlesResourceDisposal]
|
non-static non-private method of disposable types, input parameter of disposable types, property or field of disposable types | methods, parameters, properties, fields |
Annotate with [IgnoreSpellingAndGrammarErrors]
|
parameter is an input parameter | parameters |
Annotate with [ItemNotNull]
|
nullable annotation context (C# 8.0 or higher) is not enabled and type is IEnumerable<T> (or descendant), or type is Task<T> (or any other generic task-like type), or Lazy<T> and T is a reference type |
methods, parameters, properties, delegates, fields |
Annotate with [InstantHandle]
|
type is IEnumerable<T> (but not a descendant), IAsyncEnumerable<T> (but not a descendant), or a delegate |
parameters |
Annotate with [LinqTunnel]
|
the method has at least one IEnumerable<T> (but not a descendant) parameter and the return type is also an IEnumerable<T> (but not a descendant) or method has at least one IAsyncEnumerable<T> (but not a descendant) parameter and the return type is also an IAsyncEnumerable<T> (but not a descendant) |
methods |
Annotate with [MustDisposeResource] or [MustDisposeResource(false)]
|
disposable types constructors of such types, method with disposable return type, non-input parameter of disposable types | types, constructors, methods (and replaces the [Pure] or [MustUseReturnValue] annotation, if exists), parameters |
Annotate with [MustUseReturnValue] (with observable state changes) |
return type is not void
|
methods (and replaces the [Pure] or [MustDisposeResource] annotation, if exists) |
Annotate with [NonNegativeValue]
|
type is int , long , short , or sbyte
|
methods, parameters, properties, delegates, fields |
Annotate with [Pure] (no observable state changes) |
return type is not void or the method has out parameters and it does not have any ref parameter |
methods (and replaces the [MustUseReturnValue] or [MustDisposeResource] annotation, if exists) |
Annotate with [ValueRange(...)]
|
type is int , long , short , sbyte , uint , ulong , ushort , or byte
|
methods, parameters, properties, delegates, fields |