I want to give to analyzer information about nullable or not item inside of Task.
For example:
[NotNull]
[CoolAttributeForTask]
public Task<object> DoHardWordAsync()
{
return Task.FromResult(null);
}
In this case, I want to say to analyzer: "I know that item inside task can be null, analyze it, please".
How I can do this?
You can use [ItemCanBeNull]
/[ItemNotNull]
attributes for collection-like types (e.g. List<T>
, IEnumerable<T>
), task-like types (Task<T>
, ValueTask<T>
) and Lazy<T>
.