Hello I have the following question, is it possible to make an inline if statement?
var contact= new XElement("Contact",
new XAttribute("id", id.ToString()),
new XElement("ContactData",
new XElement("Prefix", person.Prefix),
new XElement("FirstName", person.FirstName)
);
Because sometimes person.x could be null and its bringing me errors.
thanks in advance for any help.
You could try something like this
The syntax is
(condition ? truevalue : falsevalue)