How do I specify that a Func object doesn't return null with JetBrains annotations?

坚强是说给别人听的谎言 提交于 2020-01-13 16:18:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!