The requirement - move Amarillo College Lamplight's newsletter users from a system I wrote a few years ago (in .NET 1.1) to the new CASK Newsletter; we're moving data from a XML file to a SQL Server table. Since this is a labor of love (we volunteer our services to the children's theatre) it would be nice to keep it short and simple; otherwise higher priorities have a tendency to back-burner their requirements.
Enter stage-left, LINQ and LINQPad! With a few lines of code the following:
<?xml version="1.0" standalone="yes"?>
<Newsletter>
<User>
<Email>Diane@Di-ForGod.com</Email>
<Name>Diane Kratochvil</Name>
<Relation>Robert's Mom</Relation>
<Validated>:)</Validated>
<guid>fbbf0f8a-91a9-4d5d-93a5-94b26b47943f</guid>
</User>
<User>
<Email>bill@global-webnet.com</Email>
<Name>Bill Kratochvil</Name>
<Relation>Robert's Dad</Relation>
<Validated>:)</Validated>
<guid>37922a89-b5d6-42bb-a34a-282ff5eea439</guid>
</User>
<User>
<Email>Koetting-cd@actx.edu</Email>
<Name>Cyndie Koetting</Name>
<Relation>Director</Relation>
<Validated>:)</Validated>
<guid>fc574089-4655-466e-8b52-485684b0e168</guid>
</User>
<User>
Becomes:
While the conversion was taking place the director needed to send a newsletter out; we weren't ready yet so we had to generate a list of email addresses for her to paste into outlook. LinqPad comes to the rescue:
With a couple lines of code (literally) I was able to generate a lit of all email addresses (comma delimited) and copy them into the clipboard (highlighted in blue above); we emailed the director the list.
Tags:
linq,
linqpad
Categories: