i calling third party service , in response they're returning object[] called items. object array has few different objects different types inside array.
here's items in cs file:
[system.xml.serialization.xmlelementattribute("report", typeof(report))] [system.xml.serialization.xmlelementattribute("_product", typeof(_product))] [system.xml.serialization.xmlelementattribute("_property_information", typeof(_property_information))] public object[] items { { return this.itemsfield; } set { this.itemsfield = value; } } i need access _property_information object inside items array. however, not sure best way approach such task.
here currently have:
var items = response.response_data[0].property_information_response.items; foreach (_property_information info in items) { parsedstreetaddress = info.property._parsed_street_address; } is there better way less lines of code accomplish same thing? i'm getting each _property_information that's inside items array.
how using linq
_property_information result = response.response_data[0].property_information_response.items .first(x => x _property_information);
Comments
Post a Comment