<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>Random Stuff - Comments</title>
    <link>http://knab.ws/blog/</link>
    <description>Random Stuff - Software development and personal miscellaneousness</description>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:" />
    <generator>Serendipity 1.1.2 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://knab.ws/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Random Stuff - Comments - Random Stuff - Software development and personal miscellaneousness</title>
        <link>http://knab.ws/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Howard: Secure POP3 client for C#</title>
    <link>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#c30956</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=2</wfw:comment>

    

    <author>paynehd@gmail.com (Howard)</author>
    <content:encoded>
    to add the NET 2.0 code...&lt;br /&gt;
&lt;br /&gt;
Add two new includes:&lt;br /&gt;
using System.Net.Security;&lt;br /&gt;
using System.Security.Cryptography.X509Certificates;&lt;br /&gt;
&lt;br /&gt;
Commneted out this include&lt;br /&gt;
//using Org.Mentalis.Security.Ssl;&lt;br /&gt;
&lt;br /&gt;
Next, locate the Connect method:&lt;br /&gt;
&lt;br /&gt;
public void Connect(string strHost, int intPort, bool secure)...&lt;br /&gt;
&lt;br /&gt;
Comment out the existing lines:&lt;br /&gt;
//reader = new StreamReader(clientSocket.GetStream(), Encoding.Default, true);&lt;br /&gt;
&lt;br /&gt;
//writer = new StreamWriter(clientSocket.GetStream());&lt;br /&gt;
&lt;br /&gt;
Replace with code mentioned above.(repeated here...)&lt;br /&gt;
&lt;br /&gt;
//Create a new SslStream and then pass that SslStream into the constructor &lt;br /&gt;
&lt;br /&gt;
// of the StreamReader and the StreamWriter. The rest of POPClient will work as-is.&lt;br /&gt;
                        &lt;br /&gt;
SslStream stream = new SslStream(clientSocket.GetStream(), false, delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) { return true; });&lt;br /&gt;
&lt;br /&gt;
stream.AuthenticateAsClient(strHost);&lt;br /&gt;
&lt;br /&gt;
reader = new StreamReader(stream);&lt;br /&gt;
writer = new StreamWriter(stream); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tested the changes using the POP3TEST that was part of the download&lt;br /&gt;
&lt;br /&gt;
I used a gmail account and was able to retrieve all email from that gmail account...&lt;br /&gt;
&lt;br /&gt;
Howard 
    </content:encoded>

    <pubDate>Thu, 18 Dec 2008 18:24:56 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/2-guid.html#c30956</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Hauke: CSV file parser and writer in C# (Part 1)</title>
    <link>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#c30955</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=3</wfw:comment>

    

    <author>pauke@web.de (Hauke)</author>
    <content:encoded>
    I used stream.WriteLine() instead of stream.Write(&#039;\n&#039;).&lt;br /&gt;
So the stream can decide itself which end of line chars to use. 
    </content:encoded>

    <pubDate>Fri, 12 Dec 2008 11:01:52 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/3-guid.html#c30955</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Paul: CSV file parser and writer in C# (Part 1)</title>
    <link>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#c30954</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=3</wfw:comment>

    

    <author>pauldevis@saturnvibes.com (Paul)</author>
    <content:encoded>
    Thank You for the code Andreas. Works perfectly. But you might wanna add &#039;stream.flush()&#039; at the end of the code. 
    </content:encoded>

    <pubDate>Fri, 12 Dec 2008 04:25:18 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/3-guid.html#c30954</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>terry: Secure POP3 client for C#</title>
    <link>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#c30953</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=2</wfw:comment>

    

    <author>flesheatingmonkeyvirus@hotmail.com (terry)</author>
    <content:encoded>
    kevins change is the one you want. works and is dead easy to implement. 
    </content:encoded>

    <pubDate>Fri, 05 Dec 2008 20:57:08 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/2-guid.html#c30953</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>tinki98: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30952</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>pujain@hotmail.com (tinki98)</author>
    <content:encoded>
    I am able to create/write/save csv file .&lt;br /&gt;
excellent code.&lt;br /&gt;
But I need further assistance as to saving that csv file in a particular type. Currently my file is being saved as &quot;CSV(Comma delimited) (*.csv).&lt;br /&gt;
But i would like to save it as CSV(MS-DOS)(*.csv).&lt;br /&gt;
Please let me know. 
    </content:encoded>

    <pubDate>Wed, 22 Oct 2008 19:15:40 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30952</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Craig Fowler: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30951</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>craig@craigfowler.me.uk (Craig Fowler)</author>
    <content:encoded>
    This looks like excellent work, and is just what I needed.  Added to StumbleUpon 
    </content:encoded>

    <pubDate>Mon, 13 Oct 2008 12:14:05 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30951</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Andreas Knab: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30950</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>andreas@knab.ws (Andreas Knab)</author>
    <content:encoded>
    I&#039;ll have to check that out, should be easy to fix... 
    </content:encoded>

    <pubDate>Wed, 06 Aug 2008 22:12:44 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30950</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Joseph: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30949</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>joseph.marks@pinerivercapital.com (Joseph)</author>
    <content:encoded>
    Hi.&lt;br /&gt;
&lt;br /&gt;
This is a great article, but could you show some example code how to call the example code from main?  I&#039;m thinking of having some line to open file &quot;a.csv&quot; in the current directory.&lt;br /&gt;
&lt;br /&gt;
Is this code meant to be run from Command Prompt, or some other way, such as through Excel?&lt;br /&gt;
&lt;br /&gt;
Or is it part of a VSTO project or something?&lt;br /&gt;
&lt;br /&gt;
Thanks. 
    </content:encoded>

    <pubDate>Wed, 30 Jul 2008 22:37:48 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30949</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Sachin: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30948</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>sachindubey2@gmail.com (Sachin)</author>
    <content:encoded>
    COde Not working...&lt;br /&gt;
&lt;br /&gt;
if csv file has any unsigned values like / or blank space the loop break at that point..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
so not validated 
    </content:encoded>

    <pubDate>Wed, 02 Jul 2008 07:51:20 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30948</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Walter: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30947</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>waltertboyd@yahoo.com (Walter)</author>
    <content:encoded>
    Nice job.  Found a bug:  If the last &quot;cell&quot; in the file is an empty string it&#039;s ignored.  (IE, &quot;1,2,3,4,&quot; would return 4 elements instead of 5, with the 5th element being just an empty string)&lt;br /&gt;
&lt;br /&gt;
I modified CsvStream.GetNextRow() to resolve this.  Modified the &quot;if (EOL)&quot; block to this:&lt;br /&gt;
                if (EOL || EOS)&lt;br /&gt;
                {&lt;br /&gt;
                    EOL = false;&lt;br /&gt;
                    EOS = false;&lt;br /&gt;
                    return null;&lt;br /&gt;
                }&lt;br /&gt;
and in the loop, modified the &quot;if (EOS)&quot; block to this:&lt;br /&gt;
if (EOS)&lt;br /&gt;
  return item.ToString();&lt;br /&gt;
&lt;br /&gt;
(got rid of &quot;return item.Length &gt; 0 ? item.ToString() : null;&quot;) 
    </content:encoded>

    <pubDate>Wed, 11 Jun 2008 18:56:59 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30947</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Steve Trefethen: CSV file parser and writer in C# (Part 1)</title>
    <link>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#c30946</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=3</wfw:comment>

    

    <author>stref@yahoo.com (Steve Trefethen)</author>
    <content:encoded>
    You may be interested in the Open Source FileHelpers library for parsing CVS files it&#039;s very handy. Here is a post I wrote about it:&lt;br /&gt;
&lt;br /&gt;
http://www.stevetrefethen.com/blog/ProcessingCSVFilesInCUsingOpenSourceFileHelpersLibrary.aspx 
    </content:encoded>

    <pubDate>Wed, 28 May 2008 22:30:31 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/3-guid.html#c30946</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>clay: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30945</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>calberty[at]iwanttss[dot]com (clay)</author>
    <content:encoded>
    I was having problems with the Jet ODBC engine only loading 255 columns from a csv file, this saved me a bunch of time over writing my own parser.  Thanks for the link to csv spec too, I always wondered how it handled line breaks mid-record... 
    </content:encoded>

    <pubDate>Thu, 10 Apr 2008 19:06:47 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30945</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>ehehe: Secure POP3 client for C#</title>
    <link>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#c30850</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/2-Secure-POP3-client-for-C.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=2</wfw:comment>

    

    <author>aaa@aaa.sk (ehehe)</author>
    <content:encoded>
    i have following problems with openPop&lt;br /&gt;
1. it seems to fail parsing messages without body&lt;br /&gt;
2. there is only one method to disconnect which is called if internal error occurs too&lt;br /&gt;
&lt;br /&gt;
this method commits pop3 transaction =&gt; mails are deleted server side but processed with errors =&gt; lost&lt;br /&gt;
&lt;br /&gt;
so in POPClient.cs i removed line SendCommand(&quot;QUIT&quot;, true); in Disconnect method - this rollbacks transaction&lt;br /&gt;
&lt;br /&gt;
and added new method QuitAndDisconnect (original Disconnect) - this commits transaction 
    </content:encoded>

    <pubDate>Thu, 21 Feb 2008 20:17:08 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/2-guid.html#c30850</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>john: CSV file parser and writer in C# (Part 2)</title>
    <link>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#c30849</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/10-CSV-file-parser-and-writer-in-C-Part-2.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=10</wfw:comment>

    

    <author>john@hotmail.com (john)</author>
    <content:encoded>
    Hi. Really nice program. Im having problem with flawed csv with newline in an cell that isnt inclosed in &quot;&quot;. Ive tried adding &quot;&quot; manually but cant get it to work. 
    </content:encoded>

    <pubDate>Tue, 05 Feb 2008 08:12:55 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/10-guid.html#c30849</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Adam Schaible: CSV file parser and writer in C# (Part 1)</title>
    <link>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#c30848</link>
            <category></category>
    
    <comments>http://knab.ws/blog/index.php?/archives/3-CSV-file-parser-and-writer-in-C-Part-1.html#comments</comments>
    <wfw:comment>http://knab.ws/blog/wfwcomment.php?cid=3</wfw:comment>

    

    <author>aschaible@racoindustries.com (Adam Schaible)</author>
    <content:encoded>
    I wanted some more flexibility here, so here&#039;s my take on it.&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Reflection;&lt;br /&gt;
&lt;br /&gt;
namespace OmegaWeb.util&lt;br /&gt;
{&lt;br /&gt;
    public class CsvWriter&lt;br /&gt;
    {&lt;br /&gt;
        public static string WriteToString(DataTable table, bool header, bool quoteall)&lt;br /&gt;
        {&lt;br /&gt;
            StringWriter writer = new StringWriter();&lt;br /&gt;
            WriteToStream(writer, table, header, quoteall);&lt;br /&gt;
            return writer.ToString();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public static string WriteToString&lt;T&gt;(IEnumerable&lt;T&gt; enumerable, String[] propertiesToSkip, bool header, bool quoteall, IList&lt;CsvModifier&gt; modifiers)&lt;br /&gt;
        {&lt;br /&gt;
            DataTable table = GetDataTableFromIEnumerable&lt;T&gt;(enumerable, propertiesToSkip, modifiers);&lt;br /&gt;
            StringWriter writer = new StringWriter();&lt;br /&gt;
            WriteToStream(writer, table, header, quoteall);&lt;br /&gt;
            return writer.ToString();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public static void WriteToStream&lt;T&gt;(TextWriter stream, IEnumerable&lt;T&gt; enumerable, String[] propertiesToSkip, bool header, bool quoteall, IList&lt;CsvModifier&gt; modifiers)&lt;br /&gt;
        {&lt;br /&gt;
            DataTable table = GetDataTableFromIEnumerable&lt;T&gt;(enumerable, propertiesToSkip, modifiers);&lt;br /&gt;
            WriteToStream(stream, table, header, quoteall);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public static void WriteToStream(TextWriter stream, DataTable table, bool header, bool quoteall)&lt;br /&gt;
        {&lt;br /&gt;
            if (header)&lt;br /&gt;
            {&lt;br /&gt;
                for (int i = 0; i &lt; table.Columns.Count; i++)&lt;br /&gt;
                {&lt;br /&gt;
                    WriteItem(stream, table.Columns[i].Caption, quoteall);&lt;br /&gt;
                    if (i &lt; table.Columns.Count - 1)&lt;br /&gt;
                        stream.Write(&#039;,&#039;);&lt;br /&gt;
                    else&lt;br /&gt;
                        stream.Write(&#039;\n&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            foreach (DataRow row in table.Rows)&lt;br /&gt;
            {&lt;br /&gt;
                for (int i = 0; i &lt; table.Columns.Count; i++)&lt;br /&gt;
                {&lt;br /&gt;
                    WriteItem(stream, row[i], quoteall);&lt;br /&gt;
                    if (i &lt; table.Columns.Count - 1)&lt;br /&gt;
                        stream.Write(&#039;,&#039;);&lt;br /&gt;
                    else&lt;br /&gt;
                        stream.Write(&#039;\n&#039;);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private static void WriteItem(TextWriter stream, object item, bool quoteall)&lt;br /&gt;
        {&lt;br /&gt;
            if (item == null)&lt;br /&gt;
                return;&lt;br /&gt;
            string s = item.ToString();&lt;br /&gt;
            if (quoteall || s.IndexOfAny(&quot;\&quot;,\x0A\x0D&quot;.ToCharArray()) &gt; -1)&lt;br /&gt;
                stream.Write(&quot;\&quot;&quot; + s.Replace(&quot;\&quot;&quot;, &quot;\&quot;\&quot;&quot;) + &quot;\&quot;&quot;);&lt;br /&gt;
            else&lt;br /&gt;
                stream.Write(s);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public static DataTable GetDataTableFromIEnumerable&lt;T&gt;(IEnumerable&lt;T&gt; aIEnumerable, String[] propertiesToSkip, IList&lt;CsvModifier&gt; modifiers)&lt;br /&gt;
        {&lt;br /&gt;
            DataTable _returnTable = new DataTable();&lt;br /&gt;
&lt;br /&gt;
            if (aIEnumerable.Count&lt;T&gt;() &gt; 0)&lt;br /&gt;
            {&lt;br /&gt;
                //Creates the table structure looping in the in the first element of the list&lt;br /&gt;
                object _baseObj = aIEnumerable.First&lt;T&gt;();&lt;br /&gt;
&lt;br /&gt;
                Type objectType = _baseObj.GetType();&lt;br /&gt;
&lt;br /&gt;
                PropertyInfo[] properties = objectType.GetProperties();&lt;br /&gt;
&lt;br /&gt;
                DataColumn _col;&lt;br /&gt;
&lt;br /&gt;
                foreach (PropertyInfo property in properties)&lt;br /&gt;
                {&lt;br /&gt;
                    if (!propertiesToSkip.Contains&lt;String&gt;((String)property.Name))&lt;br /&gt;
                    {&lt;br /&gt;
                        _col = new DataColumn();&lt;br /&gt;
                        _col.ColumnName = (string)property.Name;&lt;br /&gt;
                        if (property.PropertyType == typeof(DateTime?))&lt;br /&gt;
                        {&lt;br /&gt;
                            _col.DataType = typeof(DateTime);&lt;br /&gt;
                        }&lt;br /&gt;
                        else if (property.PropertyType == typeof(Int32?))&lt;br /&gt;
                        {&lt;br /&gt;
                            _col.DataType = typeof(Int32);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                            _col.DataType = property.PropertyType;&lt;br /&gt;
                        }&lt;br /&gt;
                        _returnTable.Columns.Add(_col);&lt;br /&gt;
                    }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                foreach (CsvModifier modifier in modifiers)&lt;br /&gt;
                {&lt;br /&gt;
                    _col = new DataColumn();&lt;br /&gt;
                    _col.ColumnName = modifier.columnName();&lt;br /&gt;
                    _col.DataType = modifier.getDataType();&lt;br /&gt;
                    _returnTable.Columns.Add(_col);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Adds the rows to the table &lt;br /&gt;
                DataRow _row;&lt;br /&gt;
&lt;br /&gt;
                foreach (object objItem in aIEnumerable)&lt;br /&gt;
                {&lt;br /&gt;
&lt;br /&gt;
                    _row = _returnTable.NewRow();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                    foreach (PropertyInfo property in properties)&lt;br /&gt;
                    {&lt;br /&gt;
                        Object value = property.GetValue(objItem, null);&lt;br /&gt;
                        if (value != null &amp;&amp;amp; !propertiesToSkip.Contains&lt;String&gt;(property.Name))&lt;br /&gt;
                        {&lt;br /&gt;
                            _row[property.Name] = value;&lt;br /&gt;
                        }&lt;br /&gt;
                    }&lt;br /&gt;
&lt;br /&gt;
                    foreach (CsvModifier modifier in modifiers)&lt;br /&gt;
                    {&lt;br /&gt;
                        _row[modifier.columnName()] = modifier.getData(objItem);&lt;br /&gt;
                    }&lt;br /&gt;
&lt;br /&gt;
                    _returnTable.Rows.Add(_row);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            return _returnTable;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here&#039;s my CSV Modifier interface:&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Text;&lt;br /&gt;
&lt;br /&gt;
namespace OmegaWeb.util&lt;br /&gt;
{&lt;br /&gt;
    public interface CsvModifier&lt;br /&gt;
    {&lt;br /&gt;
        String columnName();&lt;br /&gt;
        Object getData(Object inputData);&lt;br /&gt;
        Type getDataType();&lt;br /&gt;
    }&lt;br /&gt;
} 
    </content:encoded>

    <pubDate>Mon, 04 Feb 2008 19:46:10 +0000</pubDate>
    <guid isPermaLink="false">http://knab.ws/blog/index.php?/archives/3-guid.html#c30848</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/</creativeCommons:license>
</item>

</channel>
</rss>