Skip to content

Instantly share code, notes, and snippets.

@JAChapmanII
Created January 31, 2014 14:57
Show Gist options
  • Save JAChapmanII/8733593 to your computer and use it in GitHub Desktop.
Save JAChapmanII/8733593 to your computer and use it in GitHub Desktop.
Short untested example of what some XDocument/LINQ usage in C# would convert to in VB.Net with XML literals
// http://stackoverflow.com/questions/1542073/xdocument-or-xmldocument
// Customers is a List<Customer>
XElement customersElement = new XElement("customers",
customers.Select(c => new XElement("customer",
new XAttribute("name", c.Name),
new XAttribute("lastSeen", c.LastOrder)
new XElement("address",
new XAttribute("town", c.Town),
new XAttribute("firstline", c.Address1),
// etc
));
' Customers is a List(Of Customer)
Dim customersElement =
<customers>
<%= From c In Customers Select
<customer name=<%= c.Name %> lastSeen=<%= c.LastOrder %>>
<address town=<%= c.Town %> firstline=<%= c.Address1 %> ...etc... />
</customer>
%>
</customers>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment