<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://saguiitay.spaces.live.com/mmm2008-05-17_13.22/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fsaguiitay.spaces.live.com%2fcategory%2fGeneral%2b__x1Net%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Itay's space: General .Net</title><description /><link>http://saguiitay.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catGeneral%2b__x1Net</link><language>en-US</language><pubDate>Wed, 23 Jul 2008 03:21:52 GMT</pubDate><lastBuildDate>Wed, 23 Jul 2008 03:21:52 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://saguiitay.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>4287375271627483618</live:id><live:alias>saguiitay</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>User friendly file size</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!805.entry</link><description>&lt;p&gt;Based on a utility method found in the Microsoft.SharePoint.Utilities.SPUtility class, here's a method to get a user-friendly text for a file size:  &lt;pre&gt;&lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; FormatSize(&lt;span style="color:rgb(0,0,255)"&gt;long&lt;/span&gt; cbSize)
{
    &lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt; num;
    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (cbSize &amp;lt;= 1024L)
    {
        &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (cbSize &amp;lt;= 0L)
        {
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;{0} KB&amp;quot;&lt;/span&gt;, &lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;0&amp;quot;&lt;/span&gt;);
        }
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;&amp;lt; 1 KB&amp;quot;&lt;/span&gt;);
    }
    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (cbSize &amp;lt;= 1048576L)
    {
        num = &lt;span style="color:rgb(43,145,175)"&gt;Math&lt;/span&gt;.Round((&lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt;)(&lt;span style="color:rgb(43,145,175)"&gt;Convert&lt;/span&gt;.ToDouble(cbSize) / 1024.0), 1);
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;{0} KB&amp;quot;&lt;/span&gt;, num);
    }
    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (cbSize &amp;lt;= 1073741824L)
    {
        num = &lt;span style="color:rgb(43,145,175)"&gt;Math&lt;/span&gt;.Round((&lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt;)(&lt;span style="color:rgb(43,145,175)"&gt;Convert&lt;/span&gt;.ToDouble(cbSize) / 1048576.0), 1);
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;{0} MB&amp;quot;&lt;/span&gt;, num);
    }

    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (cbSize &amp;lt;= 1099511627776L)
    {
        num = &lt;span style="color:rgb(43,145,175)"&gt;Math&lt;/span&gt;.Round((&lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt;)(&lt;span style="color:rgb(43,145,175)"&gt;Convert&lt;/span&gt;.ToDouble(cbSize) / 1073741824.0), 1);
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;{0} GB&amp;quot;&lt;/span&gt;, num);
    }

    num = &lt;span style="color:rgb(43,145,175)"&gt;Math&lt;/span&gt;.Round((&lt;span style="color:rgb(0,0,255)"&gt;double&lt;/span&gt;)(&lt;span style="color:rgb(43,145,175)"&gt;Convert&lt;/span&gt;.ToDouble(cbSize) / 1099511627776.0), 1);
    &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;{0} TB&amp;quot;&lt;/span&gt;, num);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+User+friendly+file+size&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!805.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!805.entry</guid><pubDate>Fri, 01 Feb 2008 21:07:13 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!805/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!805.entry#comment</wfw:comment><dcterms:modified>2008-02-01T21:07:13Z</dcterms:modified></item><item><title>Utility classes: Negative arrays</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!803.entry</link><description>&lt;p&gt;Playing around with &lt;a href="http://www.aisto.com/roeder/dotnet" target="_blank"&gt;Lutz Roeder's .Net Reflector&lt;/a&gt;, I came across a very simple implementation of a &amp;quot;negative&amp;quot; array inside the Microsoft.SharePoint.Utilities namespace: NegativeArray. This class allows you to work with a &amp;quot;two-way&amp;quot; array: Creating a NegativeArray of size 10, you will have an array, with indices ranging from -10 to 10. &lt;p&gt;Where's the class implementation: &lt;p&gt; &lt;pre&gt;&lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;NegativeArray
&lt;/span&gt;{
    &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[] negative;
    &lt;span style="color:rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[] positive;

    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; NegativeArray(&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; maxIndex)
    {
        &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.positive = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[maxIndex + 1];
        &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.negative = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[maxIndex];
    }

    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; NegativeArray(&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; maxIndex, &lt;span style="color:rgb(43,145,175)"&gt;NegativeArray&lt;/span&gt; source)
    {
        &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.positive = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[maxIndex + 1];
        &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.negative = &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt;[maxIndex];
        &lt;span style="color:rgb(0,0,255)"&gt;for&lt;/span&gt; (&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; i = -source.MaxIndex; i &amp;lt;= source.MaxIndex; i++)
            &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;[i] = source[i];
    }

    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;[&lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; index]
    {
        &lt;span style="color:rgb(0,0,255)"&gt;get
&lt;/span&gt;        {
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; ((index &amp;gt;= 0) &amp;amp;&amp;amp; (index &amp;lt;= &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.MaxIndex))
                &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.positive[index];

            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (index &amp;lt; -&lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.MaxIndex)
                &lt;span style="color:rgb(0,0,255)"&gt;throw&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;ArgumentOutOfRangeException&lt;/span&gt;();

            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.negative[-index - 1];
        }
        &lt;span style="color:rgb(0,0,255)"&gt;set
&lt;/span&gt;        {
            &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; ((index &amp;gt;= 0) &amp;amp;&amp;amp; (index &amp;lt;= &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.MaxIndex))
                &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.positive[index] = &lt;span style="color:rgb(0,0,255)"&gt;value&lt;/span&gt;;
            &lt;span style="color:rgb(0,0,255)"&gt;else
&lt;/span&gt;            {
                &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (index &amp;lt; -&lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.MaxIndex)
                    &lt;span style="color:rgb(0,0,255)"&gt;throw&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="color:rgb(43,145,175)"&gt;ArgumentOutOfRangeException&lt;/span&gt;();

                &lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.negative[-index - 1] = &lt;span style="color:rgb(0,0,255)"&gt;value&lt;/span&gt;;
            }
        }
    }

    &lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;int&lt;/span&gt; MaxIndex
    {
        &lt;span style="color:rgb(0,0,255)"&gt;get
&lt;/span&gt;        {
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; (&lt;span style="color:rgb(0,0,255)"&gt;this&lt;/span&gt;.positive.Length - 1);
        }
    }
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+Utility+classes%3a+Negative+arrays&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!803.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!803.entry</guid><pubDate>Tue, 29 Jan 2008 18:57:28 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!803/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!803.entry#comment</wfw:comment><dcterms:modified>2008-01-31T09:22:54Z</dcterms:modified></item><item><title>MIME Types and File Extensions</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!802.entry</link><description>&lt;p&gt;Whenever working with content of files, it is often useful to have a way to find the MIME type based on a file extension, or the other way around - finding the file extension from a MIME type. Below are 2 useful methods for such requirements:  &lt;pre&gt;&lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; GetExtensionFromMime(&lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; mimeType)
{
    &lt;span style="color:rgb(0,0,255)"&gt;try
&lt;/span&gt;    {
        &lt;span style="color:rgb(43,145,175)"&gt;RegistryKey&lt;/span&gt; key = &lt;span style="color:rgb(43,145,175)"&gt;Registry&lt;/span&gt;.ClassesRoot.OpenSubKey(&lt;span style="color:rgb(163,21,21)"&gt;@&amp;quot;Mime\Database\Content Type\&amp;quot;&lt;/span&gt; + mimeType);
        &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (key == &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;)
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;;

        &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; str = key.GetValue(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;Extension&amp;quot;&lt;/span&gt;) &lt;span style="color:rgb(0,0,255)"&gt;as&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;;
        &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (&lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.IsNullOrEmpty(str))
            &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Empty;
        
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; str;
    }
    &lt;span style="color:rgb(0,0,255)"&gt;catch
&lt;/span&gt;    {
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;.Empty;
    }
}

&lt;span style="color:rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; GetMimeFromExtension(&lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt; ext)
{
    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (!ext.StartsWith(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;))
        ext = &lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;.&amp;quot;&lt;/span&gt; + ext;
    &lt;span style="color:rgb(43,145,175)"&gt;RegistryKey&lt;/span&gt; key = &lt;span style="color:rgb(43,145,175)"&gt;Registry&lt;/span&gt;.ClassesRoot.OpenSubKey(ext);
    &lt;span style="color:rgb(0,0,255)"&gt;if&lt;/span&gt; (key == &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;)
        &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;null&lt;/span&gt;;

    &lt;span style="color:rgb(0,0,255)"&gt;return&lt;/span&gt; key.GetValue(&lt;span style="color:rgb(163,21,21)"&gt;&amp;quot;Content Type&amp;quot;&lt;/span&gt;) &lt;span style="color:rgb(0,0,255)"&gt;as&lt;/span&gt; &lt;span style="color:rgb(0,0,255)"&gt;string&lt;/span&gt;;
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+MIME+Types+and+File+Extensions&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!802.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!802.entry</guid><pubDate>Tue, 29 Jan 2008 18:40:06 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!802/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!802.entry#comment</wfw:comment><dcterms:modified>2008-01-29T18:40:06Z</dcterms:modified></item><item><title>SqlCE doesn't support TRUNCATE TABLE</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!788.entry</link><description>&lt;p&gt;Not long ago, I modified a piece of code to use SqlCE as a data store. The older code was using OleDb to access an MS Access file. &lt;p&gt;As part of the modifications, our team did a general overview of much of the data access code. We did many changes, more than I can even number. Here is a partial list: &lt;ul&gt; &lt;li&gt;Review of table keys, indices and restrictions.  &lt;li&gt;Usage of IDbCommand instead of SQL string statements.  &lt;li&gt;Removed legacy object model.  &lt;li&gt;Replaced consecutive DELETE and INSERT statements with UPDATE.  &lt;li&gt;and so on.&lt;/ul&gt; &lt;p&gt;A few days ago, I noticed some delay in the data layer. This was nothing new - we process a huge amount of data - but since the many improvements, what used to be fast might now appear slow compared to the optimized code. After some search I've come up to a method that clears a many tables in the database. Something along the lines of:&lt;pre&gt;&lt;span&gt;using&lt;/span&gt; (IDbCommand cmd = DAL.GetClearTableCommand(tablename))
{
    &lt;span&gt;// cmd.CommandText == &amp;quot;DELETE FROM &amp;quot; + tablename&lt;/span&gt;
    cmd.ExecuteNonQuery();
}
&lt;/pre&gt;
&lt;p&gt;This of course, is nothing fancy or special. My thought was, instead of performing a DELETE statement, why not use the TRUNCATE TABLE statement, which is faster and more efficient. To my surprise, changing the GetClearTableCommand() method to return a TRUNCATE TABLE statement results in an parsing exception.
&lt;p&gt;After some research, I've found that the TRUNCATE TABLE statement is not supported/implemented in SqlCE. Much to my disappointment, I will have to leave the DELETE statement in place, until I find a faster solution. 
&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+SqlCE+doesn't+support+TRUNCATE+TABLE&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!788.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!788.entry</guid><pubDate>Mon, 01 Oct 2007 19:08:14 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!788/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!788.entry#comment</wfw:comment><dcterms:modified>2007-10-01T19:08:14Z</dcterms:modified></item><item><title>Allowing timeout on long-running operations - possible bug - Miscellaneous Debris</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!785.entry</link><description>&lt;p&gt;Avner Kashtan writes in his &lt;a href="http://weblogs.asp.net/avnerk/default.aspx" target="_blank"&gt;blog&lt;/a&gt; about an interesting problem, and solution, on how to run a long-running operation, with a timeout. The solution involves, obviously, running the code in a different thread. The possible bug is an unhandled exception in the different thread, which might kill the whole application process. &lt;p&gt;The suggested solution is to catch the exception in the running thread, and &amp;quot;passing the exception backward&amp;quot;. This is possible thanks to the us of an anonymous delegate. &lt;p&gt;Although this is indeed, as mentioned in the post, an ugly solution, I find myself wondering what's the penalty of doing such a thing. Is the performance degraded so much? Is it such a horrible OOP crime? &lt;p&gt;&lt;a href="http://weblogs.asp.net/avnerk/archive/2007/08/27/allowing-timeout-on-long-running-operations-possible-bug.aspx"&gt;Allowing timeout on long-running operations - possible bug - Miscellaneous Debris&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+Allowing+timeout+on+long-running+operations+-+possible+bug+-+Miscellaneous+Debris&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!785.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!785.entry</guid><pubDate>Sat, 29 Sep 2007 15:09:47 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!785/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!785.entry#comment</wfw:comment><dcterms:modified>2007-09-29T15:09:47Z</dcterms:modified></item><item><title>Design Patterns Implementation in a Storage Explorer Application</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!708.entry</link><description>&lt;div&gt;Although a bit old, I found the well-written, interesting article by Breman Sinaga, &lt;a href="http://www.codeproject.com/cs/design/sinagastorageexplorer.asp"&gt;Design Patterns Implementation in a Storage Explorer Application&lt;/a&gt; to be an excellente piece of work, explaining about several design patterns, such as &lt;a href="http://en.wikipedia.org/wiki/Strategy_pattern"&gt;Strategy&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Observer_design_pattern"&gt;Observer&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Adapter_pattern"&gt;Adapter &lt;/a&gt;and &lt;a href="http://en.wikipedia.org/wiki/Template_method_design_pattern"&gt;Template Method&lt;/a&gt;, and showing how to corperate them all together. The result looks like a well designed, well thought-of, tool.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+Design+Patterns+Implementation+in+a+Storage+Explorer+Application&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!708.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!708.entry</guid><pubDate>Mon, 01 Jan 2007 22:27:19 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!708/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!708.entry#comment</wfw:comment><dcterms:modified>2007-01-01T22:27:19Z</dcterms:modified></item><item><title>DebbugerDisplayAttribute</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!707.entry</link><description>&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif" size=2&gt;A little late, I know, but while watching the &lt;a href="http://channel9.msdn.com/ShowPost.aspx?PostID=165493"&gt;Channel 9: Scott Nonnenberg - Visualizers in VS 2005 webcast&lt;/a&gt;, I've learned the beauty of the DebuggerDisplayAttribute.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif" size=2&gt;For those of you not familiar with this attribute, it allow you to choose how the tooltips inside the IDE while debugging will look like, and what values they will show you. Look at the following example:&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;[System.Diagnostics.&lt;/font&gt;&lt;font color="#2b91af" size=2&gt;DebuggerDisplay&lt;/font&gt;&lt;font size=2&gt;(&lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;Name={Name} ({Members.Count} members)&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;)]&lt;br&gt;&lt;/font&gt;&lt;font color="#0000ff" size=2&gt;public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;class&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace" color="#2b91af" size=2&gt;Group&lt;br&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;{&lt;br&gt;    &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt; Name;&lt;br&gt;    &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;public&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ArrayList&lt;/font&gt;&lt;font size=2&gt; Members = &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;ArrayList&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace" size=2&gt;();&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#2b91af" size=2&gt;&lt;br&gt;&lt;font face="Courier New, Courier, Monospace"&gt;Group&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt; g = &lt;/font&gt;&lt;font color="#0000ff" size=2&gt;new&lt;/font&gt;&lt;font size=2&gt; &lt;/font&gt;&lt;font color="#2b91af" size=2&gt;Group&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;();&lt;br&gt;g.Name = &lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;Administrators&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;;&lt;br&gt;g.Members.Add(&lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;User1&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;);&lt;br&gt;g.Members.Add(&lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;User2&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New, Courier, Monospace"&gt;&lt;font size=2&gt;);&lt;br&gt;g.Members.Add(&lt;/font&gt;&lt;font color="#a31515" size=2&gt;&amp;quot;User3&amp;quot;&lt;/font&gt;&lt;font size=2&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif" size=2&gt;If you run your application, and have an instance of a Group, here's how it will look like when you'll place the mouse ove the instance:&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif" size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Verdana, Geneva, Arial, Sans-serif" size=2&gt;Name=&amp;quot;Aministrator&amp;quot; (3 members);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Geneva, Arial, Sans-serif" size=2&gt;This is very usefull if you have instances of complex objects, and you'd like to shorten the time you spend understanding that's the data that you are currently debugging.&lt;/font&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+DebbugerDisplayAttribute&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!707.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!707.entry</guid><pubDate>Thu, 21 Dec 2006 09:06:28 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!707/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!707.entry#comment</wfw:comment><dcterms:modified>2006-12-21T10:57:29Z</dcterms:modified></item><item><title>Isolated storage</title><link>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!681.entry</link><description>&lt;div&gt;Although not a very technical, you should read the following article by Peter Aitken: &lt;a href="http://www.devsource.com/article2/0,1895,2002924,00.asp"&gt;Exploring .Net's Isolated Storage&lt;/a&gt;. The article doesn't go very deep, isn't very technical, and to tell the truth, I didn't find it a good read. However, it does provide a basic introduction to the very important subject of Isolated Storage.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4287375271627483618&amp;page=RSS%3a+Isolated+storage&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=saguiitay.spaces.live.com&amp;amp;GT1=saguiitay"&gt;</description><comments>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!681.entry#comment</comments><guid isPermaLink="true">http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!681.entry</guid><pubDate>Fri, 15 Sep 2006 23:13:51 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://saguiitay.spaces.live.com/blog/cns!3B7FD118142669E2!681/comments/feed.rss</wfw:commentRss><wfw:comment>http://saguiitay.spaces.live.com/Blog/cns!3B7FD118142669E2!681.entry#comment</wfw:comment><dcterms:modified>2006-09-15T23:13:51Z</dcterms:modified></item></channel></rss>