简体   繁体   中英

How to pass the linq returned xml data to another function?

var serviceLine = from ServiceLine in DataXML.Descendants("Serviceline")
                              select new
                              {
                                  ServiceLineName = ServiceLine.Attribute("Name").Value,
                                  EntityName = ServiceLine.Attribute("Entity").Value,
                                  SiteLevelName = ServiceLine.Attribute("SiteLevel").Value,
                                  FolderName = ServiceLine.Descendants("Folder"),
                                  ItemName = ServiceLine.Descendants("Item")
                              };

i need to pass the serviceline as paramenter to another method, there i need to use the query returned result. so how can i pass the return. what type i need to use to pass the returned data.

  1. Create you own type.
  2. Use Tuple
  3. Return object , in calling method use dynamic to access properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM