MustDisposeResourceAttribute - класс

Indicates that the resource disposal must be handled by the use site, meaning that the resource ownership is transferred to the callee. This annotation can be used to annotate disposable types or their constructors individually to enable the resource disposal IDE code analysis in every context where the new instance of this type is created. Factory methods and 'out' parameters can also be annotated to indicate that the return value of disposable type needs handling.

Definition

Пространство имён: Tessa.Properties.Resharper
Сборка: Tessa (в Tessa.dll) Версия: 4.1.3+7e2b1422f9b8c7c41fbbc4b151a843bed05319ab
C#
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Parameter)]
public sealed class MustDisposeResourceAttribute : Attribute
Inheritance
Object    Attribute    MustDisposeResourceAttribute

Заметки

Annotation of input parameters with this attribute is meaningless.
Constructors inherit this attribute from their type, if it is annotated, but not from the base constructors they delegate to (if any).
Resource disposal is expected to be expressed via either using (resource) statement, using var declaration, explicit 'Dispose' method call, or an argument passing to a parameter with the HandlesResourceDisposalAttribute attribute applied.

Конструкторы

MustDisposeResourceAttribute Indicates that the resource disposal must be handled by the use site, meaning that the resource ownership is transferred to the callee. This annotation can be used to annotate disposable types or their constructors individually to enable the resource disposal IDE code analysis in every context where the new instance of this type is created. Factory methods and 'out' parameters can also be annotated to indicate that the return value of disposable type needs handling.

Свойства

TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Унаследован от Attribute)
Value When set to false, disposing of the resource is not obligatory. The main use-case for explicit [MustDisposeResource(false)] annotation is to loosen inherited annotation.

Методы

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Унаследован от Attribute)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Унаследован от Object)
GetHashCodeReturns the hash code for this instance.
(Унаследован от Attribute)
GetTypeGets the Type of the current instance.
(Унаследован от Object)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Унаследован от Attribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Унаследован от Attribute)
MemberwiseCloneCreates a shallow copy of the current Object.
(Унаследован от Object)
ToStringReturns a string that represents the current object.
(Унаследован от Object)

См. также