I'm trying to loop through the results of a function that is returning an anonymous object of results.
public static object getLogoNav()
{
XDocument loaded = XDocument.Load(HttpContext.Current.Request.MapPath("~/App_Data/LOGO_NAV_LINKS.xml"));
var query = from x in loaded.Elements().Elements()
select new
{
Name = x.FirstAttribute.Value,
Value = x.Value
};
return query;
}
codebehind page:
var results = Common.getLogoNav();
foreach(var nav in results) {
string test = nav.Name;
}