Home > Generics, LINQ > Generic List of Classes to XML using LINQ

Generic List of Classes to XML using LINQ


Dim _doc As New XDocument(New XDeclaration("1.0", "UTF-8", "yes"), _
 New XElement("EmailAccounts", _
 From EMailAccount In CEmailAccountsList _
 Select New XElement("EMailAccount", _
 New XElement("AccountFromSender", EMailAccount.AccountFromSender), _
 New XElement("EMailAddress", EMailAccount.EMailAddress), _
 New XElement("MailServerAddress", EMailAccount.MailServerAddress), _
 New XElement("MailServerType", EMailAccount.MailServerType), _
 New XElement("PaperFlowImportDirectory", EMailAccount.PFImportDirectory), _
 New XElement("Password", EMailAccount.Password), _
 New XElement("Port", EMailAccount.Port), _
 New XElement("PropertyID", EMailAccount.PropertyID), _
 New XElement("PropertyIDFromSubject", EMailAccount.PropertyIDFromSubject), _
 New XElement("SecurityType", EMailAccount.SecurityType), _
 New XElement("SubjectAsIndex", EMailAccount.SubjectAsIndex), _
 New XElement("Username", EMailAccount.Username))))

 _doc.Save(constEMailSettingsFilename)

Advertisements
Categories: Generics, LINQ Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: