Skip to content

Instantly share code, notes, and snippets.

@NIA
Created December 9, 2012 12:00
Show Gist options
  • Save NIA/4244563 to your computer and use it in GitHub Desktop.
Save NIA/4244563 to your computer and use it in GitHub Desktop.
map syntax compared between Scala and C#
// "Scala": XElement.Load(xmlFileName).Descendants("element") map { _.Attribute(xmlAttribute).Value }
// Query syntax
items = from element in XElement.Load(xmlFileName).Descendants("element") select element.Attribute(xmlAttribute).Value;
// Extension method syntax
items = XElement.Load(xmlFileName).Descendants("element").Select( element => element.Attribute(xmlAttribute).Value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment