So, I've got a small chunk of stabby, pointy xml that looks like this:
<Groups UseGroup='True'>
<Group>1264,182,1979</Group>
</Groups>
And I've got a small chunk of linq that gets the value from that looks like this:
var group = from a in xml.Descendants("Groups")
select a.Element("Group").Value;
It's all fine and dandy but I don't know how to handle a null response? If I use:
if(group != null)
It will always evaluate true
because there is something there. If I use:
if(group.ToString() == "")
It will always evaluate true because ToString() called on that object returns System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String] For some reason, I'm having a hard time casting my result from my linq query to a string so I'm using var because that seems to be the only way I can get it to work...
So the question is, am I using the correct linq syntax and if so, how do i tell if it returned anything or not?