Possible null reference in Linq query

With the following code:

var query = from c in companies
let id = (c.Attribute("Id") == null) ? null :
(int?) c.Attribute("Id")
let name = (c.Attribute("Name") == null) ? "":
c.Attribute("Name").Value
select new InfoLookupDto(id.Value, name);

R# 1270.3 reports a possible NullReferenceException for
c.Attribute("Name").Value

Regards
Jeremy


__________ Information from ESET Smart Security, version of virus signature database 4247 (20090715) __________

The message was checked by ESET Smart Security.

http://www.eset.com



Please sign in to leave a comment.