Class MustBeUsedWhenReturnedAttribute
Marks a type whose values must always be observed when returned from a method.
The Olve.Results analyzer (ORES001) reports a diagnostic when a method that returns an
annotated type (directly or wrapped in Task<TResult> /
ValueTask<TResult>) is invoked as a statement without
observing the result.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, Inherited = false, AllowMultiple = false)]
public sealed class MustBeUsedWhenReturnedAttribute : Attribute
- Inheritance
-
MustBeUsedWhenReturnedAttribute
- Inherited Members
Remarks
Applied to Result, Result<T> and DeletionResult.
Dependent projects can apply it to their own result-like types. To intentionally ignore a
result, use a discard (_ = expression;) or call DiscardResult().