Implementing a Null-Checking-Method Permanently deleted user Created March 06, 2018 07:02 How can I implement a method that tells Resharper that a value has already been tested for null? Snippet
Use the ContractAnnotation attribute:
[ContractAnnotation("null => true")]public static bool IsNullOrEmpty<TEnumerable>([CanBeNull] this IEnumerable<TEnumerable> enumerable)
Thank you :-)
Is there any way to do this with Null Checking Patterns so that we are not dependent on annotations?
I'll duplicate Richard's answer here: https://resharper-support.jetbrains.com/hc/en-us/community/posts/6722297112594/comments/6729176732050