I have a method:
private int[] ParseBusyPlace(string xml)
{
var busyPlaces = from element in XDocument.Parse(xml).Descendants("Place")
select new []
{
(int) element.Attribute("ID")
};
return busyPlaces; // error
}
This query return IEnumerable<int[]>. How to return array of int?
Özgür Kara’s answer is absolutely correct, but I would rewrite it to not use a query expression, given that it’s just a from / select:
I’d also consider returning a
List<int>instead of an array, as they’re generally more pleasant to work with, but that’s a different matter.