问题
I have a bit of code:
public void Foo([NotNull] Func<string> bar)
{
//whatever
}
My problem is, the [NotNull] annotation is specifying that bar itself is not null. I'm looking instead for an annotation that says that the thing RETURNED BY BAR is not null.
I expected that this was possible but it doesn't seem to be. They support ItemNotNull for IEnumerables so I don't see why we can't have ReturnsNotNull for Func objects.
Am I just missing something obvious here? Surely something this basic is supported.
来源:https://stackoverflow.com/questions/35091582/how-do-i-specify-that-a-func-object-doesnt-return-null-with-jetbrains-annotatio