Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-291225: Add NotNull attribute to System.Linq.Enumerable.First in System.Core.LinqTunnel.xml

$
0
0
Reporter P B (permb) P B (permb)
Created Mar 23, 2012 4:21:43 PM
Updated Mar 23, 2012 4:32:08 PM
Resolved Mar 23, 2012 4:27:43 PM
Priority Normal
Type Feature
Fix versions No Fix versions
State Won't fix
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
First will never return null - it throws an exception if the item cannot be found.
FirstOrDefault however may return null.

I have seen coworkers do:

var x = y.First(x => false);
if (x == null) {
...
}

and it would be valuable to hint to them that they are either using the wrong method (should be using FirstOrDefault) or writing dead code.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>