var xmlfromLINQ = new XElement("BarList",
from c in BarList
select new XElement("Bar",
new XElement("Property1", c.Property1),
new XElement("Property2", c.Property2)
));
How To add a condition in inside a XElement property. Because some property is null, if my my property is i get error. so i need add condition if(c.Property1!=null) get the c.Property1 else return the statement. How to add it.