<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Tom Fischer</title>
        <link>http://geekswithblogs.net/ftom/Default.aspx</link>
        <description> </description>
        <language>en-US</language>
        <copyright>ftom</copyright>
        <managingEditor>aft3000@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Tom Fischer</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/ftom/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Reverse Proxy and WCF with Fiddler in 30 seconds</title>
            <category>Fiddler</category>
            <link>http://geekswithblogs.net/ftom/archive/2009/02/16/reverse-proxy-and-wcf-with-fiddler-in-30-seconds.aspx</link>
            <description>&lt;p&gt;In my current project I have to deal with a reverse proxy environment on production. &lt;/p&gt;
&lt;p&gt;Unfortunately you can not debug your application on Production and usually there is no real reverse proxy testing environment available. &lt;/p&gt;
&lt;p&gt;To test my WCF-Silverlight application I used Fiddler and custom rules to establish a decent test environment.&lt;/p&gt;
&lt;p&gt; Goal: &lt;br /&gt;
To have a reverse proxy behaviour &lt;br /&gt;
from &lt;br /&gt;
&lt;strong&gt;&lt;a href="http://mymachine:8888/Default.aspx"&gt;http://mymachine:8888/Default.aspx&lt;/a&gt;&lt;/strong&gt; &lt;br /&gt;
to &lt;br /&gt;
&lt;strong&gt;&lt;a href="http://mymymachine:80/testApp/Default.aspx"&gt;http://mymymachine:80/testApp/Default.aspx&lt;/a&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;To add these rules:&lt;br /&gt;
Fiddler -&amp;gt; Rules -&amp;gt; Custom Rules &lt;/p&gt;
&lt;p&gt;Inside the Java Script function OnBeforeRequest(oSession: Session) add the following lines: &lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #bbbbff"&gt;static function OnBeforeRequest(oSession: Session) &lt;br /&gt;
{ &lt;br /&gt;
if (oSession.host.toLowerCase() == "myMachine:8888"){ oSession.host = "mymachine:80";} &lt;br /&gt;
if( !oSession.uriContains("testApp/")){ oSession.PathAndQuery = "/testApp" + oSession.PathAndQuery; } &lt;br /&gt;
… &lt;/p&gt;
&lt;p&gt;Something interesting to note is the check for testApp. &lt;br /&gt;
If you always add the new URI part (what I first did) the MS Ajax engine gets confuesed and adds testApp/testApp to the Resources… &lt;/p&gt;
&lt;p&gt;Finaly I can exactly see what my WCF Service sends to the server and where it goes wrong.&lt;/p&gt;
&lt;p&gt;That’s it! &lt;br /&gt;
Tom&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129438"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129438" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/129438.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2009/02/16/reverse-proxy-and-wcf-with-fiddler-in-30-seconds.aspx</guid>
            <pubDate>Mon, 16 Feb 2009 17:04:54 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/129438.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2009/02/16/reverse-proxy-and-wcf-with-fiddler-in-30-seconds.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/129438.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/129438.aspx</trackback:ping>
        </item>
        <item>
            <title>Entity Framework: How to see the generated/underlying SQL</title>
            <category>Entity Framework</category>
            <link>http://geekswithblogs.net/ftom/archive/2009/01/28/entity-framework-how-to-see-the-generatedunderlying-sql.aspx</link>
            <description>&lt;p&gt;Finally I had time to start digging into the Entity Framework.&lt;/p&gt;
&lt;p&gt; I found two dnrTV videos which I highly recommend to get started. &lt;br /&gt;
&lt;a href="http://www.dnrtv.com/default.aspx?showNum=117"&gt;http://www.dnrtv.com/default.aspx?showNum=117&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.dnrtv.com/default.aspx?showNum=118"&gt;http://www.dnrtv.com/default.aspx?showNum=118&lt;/a&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt; The idea of this and hopefully follow up blogs is to have my own personal Snippets. &lt;/p&gt;
&lt;p&gt;Here comes the first one: How to see the generated SQL &lt;/p&gt;
&lt;p&gt;Here are the steps:&lt;/p&gt;
&lt;p&gt; • create your Entity Model (.edmx) from your DB and then &lt;br /&gt;
• Get an instance of your Context. &lt;br /&gt;
• Write the Query in Linq based on your contex &lt;br /&gt;
• Call ToTraceString() &lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (var ctx = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; MyDBEntities())
{
    var query = from ev &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;in&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ctx.Events
                select ev;
    var query2 = &lt;strong&gt;query &lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;as&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; ObjectQuery&amp;lt;Event&amp;gt;;&lt;/strong&gt;
    Console.WriteLine(&lt;strong&gt;query2.ToTraceString()&lt;/strong&gt;);

    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (var ev &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;in&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ctx.Events)
    {
        Console.WriteLine(ev);
    }
}
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Tom&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129028"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129028" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/129028.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2009/01/28/entity-framework-how-to-see-the-generatedunderlying-sql.aspx</guid>
            <pubDate>Wed, 28 Jan 2009 14:39:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/129028.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2009/01/28/entity-framework-how-to-see-the-generatedunderlying-sql.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/129028.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/129028.aspx</trackback:ping>
        </item>
        <item>
            <title>C# Cheating Polymorphism: Interfaces are not virtual by nature, or are they?</title>
            <category>C#</category>
            <category>.NET Framework</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/11/24/c-cheating-polymorphism-interfaces-are-not-virtual-by-nature-or.aspx</link>
            <description>&lt;p&gt;After being in TFS-Land for a couple of months and celebrating the birth of my second daughter, I finally had time to go back to do some C# coding. Hurray! &lt;/p&gt;
&lt;p&gt;Then, I ran into an interesting issue:&lt;br /&gt;
When you derive from a class which has an interface implemented you cannot just override the implement methods again. Even if you use the new keyword breaks when you cast the instance to the interface type, you might not achieve the desired result. &lt;/p&gt;
&lt;p&gt;Let's look at a quick example and deal with solutions afterwards:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;interface&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ITom
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay();
}

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; BaseClass : ITom
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()
    {
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Base Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass : BaseClass
{
    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//I have to use the new keyword&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()
    {
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"New Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}


DerivedClass d = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass();
Console.WriteLine(d.IdeaOfTheDay());
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: New Idea&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;

ITom t = d &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;as&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ITom;
Console.WriteLine(t.IdeaOfTheDay());
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: Base Idea  -&amp;gt; oops not what I hoped for&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Okay this shouldn't have come as a surprise to me. When I thought about it for a second, I realized it is standard polymorphism with contracting to a specific non virtual method. Using interfaces made me forget this for a second.&lt;/p&gt;
&lt;p&gt;If we didn't have interaces and we could not change the BaseClass to virtual or make the BaseClass abstract,  we would be done here. Even using the new keyword does not work if we cast to an interface, because the actual contract is with the BaseClass.&lt;br /&gt;
Pretty bad when you deal with customer dlls where you cannot modify the source code.&lt;/p&gt;
&lt;p style="FONT-WEIGHT: bold"&gt;Cheating Polymorphism with Interfaces in an emergency&lt;/p&gt;
&lt;p&gt;But with interfaces there is one more thing you can do if you can not change the BaseClass: &lt;br /&gt;
Just re-implement the Interface!&lt;br /&gt;
&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; BaseClass : ITom&lt;br /&gt;
{&lt;br /&gt;
   &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()&lt;br /&gt;
    {&lt;br /&gt;
       &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Base Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass : BaseClass, &lt;strong&gt;ITom&lt;/strong&gt; &lt;br /&gt;
{&lt;br /&gt;
   &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//We still need the keyword&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;br /&gt;
   &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()&lt;br /&gt;
    {&lt;br /&gt;
       &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"New Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DerivedClass d =&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass();&lt;br /&gt;
Console.WriteLine(d.IdeaOfTheDay());&lt;br /&gt;
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: New Idea&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;br /&gt;
&lt;br /&gt;
ITom t = d&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;as&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ITom;&lt;br /&gt;
Console.WriteLine(t.IdeaOfTheDay());&lt;br /&gt;
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: New Idea NOT: Base Idea anymore&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kind of messy but this can be a lifesaver!&lt;/p&gt;
&lt;p style="FONT-WEIGHT: bold"&gt;Using Polymorphism correctly with Interfaces&lt;/p&gt;
&lt;p&gt;But if you can modify the BaseClass you definitely want to use virtual methods. &lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #bbbbff"&gt;Even though Interfaces are not virtual by nature, you can still declare the method virtual in your class implementation and make them virtual!&lt;br /&gt;
This gives you the best out of both worlds: Polymorphism from Inheritance and Contracting via Interfaces. &lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; BaseClass : ITom
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: #0000ff"&gt;virtual&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()
    {
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Base Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass : BaseClass{
    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//normal overriding&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: #0000ff"&gt;override&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IdeaOfTheDay()
    {
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;return&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"New Idea"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}


DerivedClass d = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; DerivedClass();
Console.WriteLine(d.IdeaOfTheDay());
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: New Idea&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;

ITom t = d &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;as&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ITom;
Console.WriteLine(t.IdeaOfTheDay());
&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//Writes: New Idea NOT: Base Idea anymore&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Think about it: An interace is just a contract! Nothing more, nothing less!&lt;/p&gt;
&lt;p&gt;Tom&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127342"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127342" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/127342.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/11/24/c-cheating-polymorphism-interfaces-are-not-virtual-by-nature-or.aspx</guid>
            <pubDate>Mon, 24 Nov 2008 16:04:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/127342.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/11/24/c-cheating-polymorphism-interfaces-are-not-virtual-by-nature-or.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/127342.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/127342.aspx</trackback:ping>
        </item>
        <item>
            <title>TFS 2008 does sometimes not recognize changes during check in</title>
            <category>TFS</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/10/29/tfs-2008-does-sometimes-not-recognize-changes-during-check-in.aspx</link>
            <description>&lt;div&gt;
&lt;div&gt;Yesterday I ran into an interesting problem with TFS 2008 and VS2008.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;I had a web application which used a reference to webapp/bin/myLib.dll&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;To get the build scripts running I moved myLib.dll to ../SharedLibrary/myLib.dll.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Then I removed the reference to myLib.dll inside the webapp and added the reference to the new location.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Compiled and it worked fine.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Inside the Pending Change Window I saw the that the project files got checked out into edit mode. (as it supposed to)&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;So I checked them in. But TFS told me that there was no changes and did not check anything in.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Of course the build did not work because the server did not get my changes. &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;So I got latest again and of cause the project reloaded to the original settings.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;I tried nearly everything:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Deleted the references&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Restarted VS&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Checked it in.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Restarted VS&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Added the reference&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Restarted VS&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Checked it in&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;No affect always the same problem.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;At one point I did the following which finally worked:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- I went into the source control explorer and manually checked the project file out&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Unbound the Project from TFS &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Opened the project file and changed the the Reference Line manually to:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&amp;lt;Reference Include="myLib, Version=3.0.93.194, Culture=neutral, processorArchitecture=MSIL"&amp;gt;&lt;br /&gt;
      &amp;lt;SpecificVersion&amp;gt;False&amp;lt;/SpecificVersion&amp;gt;&lt;br /&gt;
      &amp;lt;HintPath&amp;gt;..\..\SharedBinaries\myLib.dll&amp;lt;/HintPath&amp;gt;&lt;br /&gt;
    &amp;lt;/Reference&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Bound the project again &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;- Checked in&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;I don't know why but the standard way did not work, but finally the build server was able to build it successfully.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;I have to admit, TFS is great but the 2008 IDE integration has more issues than the 2005 integration...&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Hope this might also help you&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Tom&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126354"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126354" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/126354.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/10/29/tfs-2008-does-sometimes-not-recognize-changes-during-check-in.aspx</guid>
            <pubDate>Wed, 29 Oct 2008 19:04:19 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/126354.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/10/29/tfs-2008-does-sometimes-not-recognize-changes-during-check-in.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/126354.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/126354.aspx</trackback:ping>
        </item>
        <item>
            <title>Our second baby girl was born</title>
            <category>misc</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/10/29/our-second-baby-girl-was-born.aspx</link>
            <description>&lt;div&gt;&lt;font face="Arial" size="2"&gt;
&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;People were asking why I did not post anymore.... Here is the exiting answer:&lt;/p&gt;
&lt;p&gt;My wife and me had our second daughter!&lt;/p&gt;
&lt;p&gt;Welcome Katja!&lt;/p&gt;
&lt;p&gt;We are totally thrilled and sooooo happy!&lt;/p&gt;
&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class="383334313-29102008"&gt;&lt;font face="Arial" size="2"&gt;Tom&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126338"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126338" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/126338.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/10/29/our-second-baby-girl-was-born.aspx</guid>
            <pubDate>Wed, 29 Oct 2008 14:44:37 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/126338.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/10/29/our-second-baby-girl-was-born.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/126338.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/126338.aspx</trackback:ping>
        </item>
        <item>
            <title>TFS Error: The item does not exist at the specified version</title>
            <category>TFS</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/09/30/tfs-error-the-item-does-not-exist-at-the-specified.aspx</link>
            <description>&lt;p&gt;After moving a branch from one TFS server to another I got the error:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;"&lt;strong&gt;The item \$TFSProject\mylocation\myfile.cs does not exist at the specified version&lt;/strong&gt;".&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;First I thought the Check in was buggy and went to another machine. And like a miracle it worked there.&lt;/p&gt;
&lt;p&gt;Then I googled and found out that this usually relates a messed up workspace.&lt;/p&gt;
&lt;p&gt;Especially the following link was very interesting:&lt;br /&gt;
&lt;font face="Arial"&gt;&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2367863&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2367863&amp;amp;SiteID=1&lt;/a&gt;&lt;br /&gt;
&lt;/font&gt;&lt;br /&gt;
But this was not my problem. &lt;br /&gt;
I had two Visual Studios (2008) open. &lt;br /&gt;
Inside one instance I used the Team Explorer to disconnect from one TFS server and connected to another TFS server without closing the second instance or restarting VS. &lt;br /&gt;
I guess the TFS integration in VS got confused and was choking.&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;So I restarted VS and everything went back to normal.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Sometimes a simple restart does the trick. But at least I learned about how to delete your workspace :-)&lt;/p&gt;
&lt;p&gt;Tom&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125558"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125558" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/125558.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/09/30/tfs-error-the-item-does-not-exist-at-the-specified.aspx</guid>
            <pubDate>Tue, 30 Sep 2008 22:15:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/125558.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/09/30/tfs-error-the-item-does-not-exist-at-the-specified.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/125558.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/125558.aspx</trackback:ping>
        </item>
        <item>
            <title>When to create a new TFS project or reuse an existing one</title>
            <category>TFS</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/09/29/when-to-create-a-new-tfs-project-or-reuse-an.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;I am sorry this is not a C# blog today. I am still in TFS land :-)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Recently I was talking to different people about when to create a new TFS project or reuse an existing one.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;Here is what I got out of the conversations:&lt;br /&gt;
- Too many projects slow down the server and are hard to maintain.  (Depending on the project type, TFS 2008 has an upper limit of around 200 - 500 projects)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- Security on too many projects can be very hard to maintain (especially keeping track of current permissions, removing expired permissions, etc.)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- Using the built-in TFS Groups in TFS is usually enough. Add NT accounts/groups manually to certain permissions if you have to. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- If the intent of adding a project to TFS is simply to have Source Control, try to stick it into a group specific (generic) TFS project. Move it later if necessary.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- If you don't know exactly how much project management will be included or how big the project will be, stick it in a current TFS project and move it later.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- Moving Source control Items from one TFS project to another works great and is very easy. The history is still searchable.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- Moving Work items is super tricky and should be minimized. See  &lt;a href="http://blogs.msdn.com/granth/archive/2008/06/26/how-to-move-work-items-between-team-projects.aspx"&gt;http://blogs.msdn.com/granth/archive/2008/06/26/how-to-move-work-items-between-team-projects.aspx&lt;/a&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- Separating Source Control and Project Management causes more work, because you have to modify the default queries.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- IF you need exclusive permissions for the same user =&amp;gt; new TFS project&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;- IF you need different Template =&amp;gt; new TFS projects &lt;br /&gt;
 &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;See  http://msdn.microsoft.com/en-us/library/ms242894.aspx for a more thorough analysis.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;I hope this might help you.&lt;br /&gt;
Tom&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;P.S.: Special thanks to Scott, Robert, and Jeevan for all your input and being a great sounding board!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125530"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125530" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/125530.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/09/29/when-to-create-a-new-tfs-project-or-reuse-an.aspx</guid>
            <pubDate>Mon, 29 Sep 2008 21:47:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/125530.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/09/29/when-to-create-a-new-tfs-project-or-reuse-an.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/125530.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/125530.aspx</trackback:ping>
        </item>
        <item>
            <title>"TFS and how to modify existing Reports" OR "Admin permissions are not enough"</title>
            <category>TFS</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/09/19/tfs-and-how-to-modify-existing-reports-or-admin-permissions.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;This is one I  worked on for a while. The biggest impediment I had was getting the permissions straightened out. Thanks to the help of my team we eventually figured it out. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;I won't go into details here about how to use Reporting Services or how to make a report pretty. Instead, I'll give a quick overview of how to pull existing projects from TFS (or, more specifically,  its Reporting Service Engine).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;As mentioned, TFS uses SQL Reporting Services for its reports. So all you need is to navigate your web browser to:&lt;br /&gt;
&lt;a href="http://yourTFSserver/Reports_TFS"&gt;http://yourTFSserver/Reports_TFS&lt;/a&gt;&lt;br /&gt;
&lt;/font&gt;&lt;font face="Arial"&gt;If you are lucky enough to have the Content Manager Site role for the whole server, you might see something.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;If you only have permissions to a specific TFS project then you better go to your project:&lt;br /&gt;
&lt;a href="http://yourTFSServer/Reports_TFS/Pages/Folder.aspx?ItemPath=%2f&amp;lt;YOURPROJECT&amp;gt;&amp;amp;ViewMode=List"&gt;http://yourTFSServer/Reports_TFS/Pages/Folder.aspx?ItemPath=%2f&amp;lt;YOURPROJECT&amp;gt;&amp;amp;ViewMode=List&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;
&lt;font face="Arial"&gt;
&lt;p&gt;&lt;br /&gt;
Then you should see all the Reports available to you. Usually you have enough permission to run them. But if you click on Show Details (in the upper right corner) and then click on edit, or if you try to click on the property tab, you are usually out of luck as a user. You will get an error telling you "Insufficient Permission".... That was my life for a while.&lt;/p&gt;
&lt;p&gt;So I was granted the Content Manager role of the specific project but this still did not fix the problem. I was able to upload and run new reports, but not to edit any of them (even the one I created...). Then I was given the admin role for this project and then the site admin role...but still no success.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To make a long story short. You need Content Manager role permission for the whole site to be able to edit a report in a specific project. Content Manager permission for a specific project is not enough. Also Administrator permissions are not enough (which was surprising to me).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Once you know that, then you're dealing with straightforward SQL Report Services. There is good docu out there so I better stop here. Hey it is Friday and my little one is waiting for me at home :-)&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;I hope this will save you some time and headache.&lt;/p&gt;
&lt;p&gt;Tom&lt;/p&gt;
&lt;p&gt;P.S.: Thank you Pinal for your help on this one!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/font&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125308"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125308" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/125308.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/09/19/tfs-and-how-to-modify-existing-reports-or-admin-permissions.aspx</guid>
            <pubDate>Fri, 19 Sep 2008 18:39:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/125308.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/09/19/tfs-and-how-to-modify-existing-reports-or-admin-permissions.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/125308.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/125308.aspx</trackback:ping>
        </item>
        <item>
            <title>How to pull all Pending Changes (Checked Out Items) from TFS 2005 or 2008</title>
            <category>TFS</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/09/17/how-to-pull-all-pending-changes-checked-out-items-from.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;How to pull all Pending Changes (Checked Out Items) from TFS 2005 or 2008&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This question cost my a day of research, so I thought it is only fair to share my results and to have a look up for myself&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #aaaaff"&gt;There are at least four different options:&lt;br /&gt;
- going to SQL directly&lt;br /&gt;
- Using the tf.exe tool (great for manual lookup)&lt;br /&gt;
- Using the TFS Webservices (painful to use) &lt;br /&gt;
- &lt;strong&gt;Using the Microsoft.TeamFoundation Libraries, which wrapp the the TFS Webservices  &lt;/strong&gt; (integrated into .NET)&lt;/p&gt;
&lt;p style="FONT-WEIGHT: bold; TEXT-DECORATION: underline"&gt;Going to SQL directly:&lt;/p&gt;
See &lt;a href="http://geekswithblogs.net/tbeaty/archive/2009/03/19/how-to-pull-all-pending-changes-checked-out-items-from.aspx"&gt;Tad Beaty's Blog&lt;/a&gt;
&lt;p style="FONT-WEIGHT: bold; TEXT-DECORATION: underline"&gt;Using the tf.exe&lt;/p&gt;
&lt;p&gt;The command line tool does an excelent job, but you have to parse it. Which I don't want to do. But it works great&lt;/p&gt;
&lt;p&gt;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE&amp;gt;&lt;strong&gt;tf status /s:&amp;lt;TfsServer&amp;gt;  /recursive /user:* /format:detailed&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Get more infos on MSDN:&lt;br /&gt;
&lt;span style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/cc31bk2e(vs.80).aspx" href="http://msdn.microsoft.com/en-us/library/cc31bk2e(vs.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc31bk2e(vs.80).aspx&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p style="FONT-WEIGHT: bold; TEXT-DECORATION: underline"&gt;The TFS Webservices&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.phase2int.com/?p=141"&gt;http://blog.phase2int.com/?p=141&lt;/a&gt;  has a list of all Availalbe Webserices exposed by TFS.&lt;/p&gt;
&lt;p&gt;What I read is that MS disencourages you to use these directly. MS advises you to use the API (next chapter). But if you need remote access then this is your best shot.&lt;/p&gt;
&lt;p&gt; If you don't need remote access you might want to consider the next option.&lt;/p&gt;
&lt;p style="FONT-WEIGHT: bold; TEXT-DECORATION: underline"&gt;The Microsoft.TeamFoundation Libraries&lt;/p&gt;
&lt;p&gt;I found multiple names for them: TFS SDK, TFS object access, etc. &lt;br /&gt;
But in the end they all refer to the MS dlls, which are used to access the TFS Webservices:&lt;br /&gt;
- Microsoft.TeamFoundation.dll&lt;br /&gt;
- Microsoft.TeamFoundation.VersionControl.Client&lt;/p&gt;
&lt;p&gt;They can be found in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies&lt;/p&gt;
&lt;p&gt;Below is the code you can use to pull all the changes now:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Microsoft.TeamFoundation.Client;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Microsoft.TeamFoundation.VersionControl.Client;

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; void GetPendingChanges(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; tfsServer)
{
 &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//connection to TFS Version Control    &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
 &lt;strong&gt;TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #800000"&gt;"&amp;lt;YOUR tfsServer&amp;gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt;);
 VersionControlServer vcs = (VersionControlServer)tfs.GetService(&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;typeof&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt;(VersionControlServer));&lt;/strong&gt;

 &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//pulling the pending changes    &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
 &lt;strong&gt;PendingSet[] pending = vcs.GetPendingSets(&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span class="style1" style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span class="style1" style="COLOR: #000000"&gt;[] { &lt;/span&gt;&lt;span class="style1" style="COLOR: #800000"&gt;"$/"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; }, RecursionType.Full);&lt;/strong&gt;
 
 &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//start printing them on the screen:    &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
 &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (var item &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;in&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; pending)
 {
    Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"\n--------------------------------"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
    Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"User: "&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + item.OwnerName);
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;if&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (item.PendingChanges != &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;null&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)
    {
        Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Number of Checked Out Files: "&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + item.PendingChanges.Length.ToString());
        Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Files:"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (var change &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;in&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; item.PendingChanges)
        {

           Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"-File: "&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + change.ServerItem);
           Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"-- ChangeType: "&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + change.ChangeTypeName);
           Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"-- Checked Out: "&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + change.CreationDate.ToString());
           Console.WriteLine(&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"-- Local file"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; + change.LocalItem);
        }
    }
 }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Of course this is not even the tip of the iceberg. There is so much more in the Libraries. I recommend you check out MSDN for the TFS SDK.&lt;/p&gt;
&lt;p&gt;There might be more on the blog in the future :-) &lt;/p&gt;
&lt;p&gt;Tom&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125235"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125235" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/125235.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/09/17/how-to-pull-all-pending-changes-checked-out-items-from.aspx</guid>
            <pubDate>Wed, 17 Sep 2008 15:28:10 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/125235.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/09/17/how-to-pull-all-pending-changes-checked-out-items-from.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/125235.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/125235.aspx</trackback:ping>
        </item>
        <item>
            <title>C# and the using Statement in 3 seconds and a bug in Reflector</title>
            <category>C#</category>
            <category>.NET Framework</category>
            <link>http://geekswithblogs.net/ftom/archive/2008/09/15/c-and-the-using-statement-in-3-seconds-and-a.aspx</link>
            <description>&lt;strong&gt;Using() Statement in 3 seconds and a bug in Reflector &lt;/strong&gt;
&lt;p style="BACKGROUND-COLOR: #bbbbff"&gt;The boring, known accross the board definition from the MSDN site: &lt;br /&gt;
Defines a scope, outside of which an object or objects will be disposed&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #9999ff"&gt;The more interesting definition from Tom: &lt;br /&gt;
The using() Statement generates a try{} finally{ //virtual call of the dispose method } block with null check!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Let's take a deeper look.&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Let's write two test methods first:&lt;br /&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #008000"&gt;//Testmethod for Using   &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; UsingTest()
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (SqlConnection con = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SqlConnection())
    {
        con.ConnectionString = &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}

&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//TestMethod for try finally&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; TryFinallytest()
{
    SqlConnection con = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SqlConnection();
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;try&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    {
        con.ConnectionString = &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;finally&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    {
        con.Dispose();
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The TryFinallyTest() method has no null check inside the finally block. This means in case con is null the function would throw a Null Reference Exception. The UsingTest() method does not. &lt;/p&gt;
&lt;p&gt;When you compile both methods and look at them disambeled in Reflector they both look exatly the same:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; UsingTest()
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (SqlConnection con = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SqlConnection())
    {
        con.ConnectionString = &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}

&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; TryFinallytest()
{
    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (SqlConnection con = &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SqlConnection())
    {
        con.ConnectionString = &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;But looking at the IL (see below) reveals a very important difference:&lt;br /&gt;
-  Frist both get translated into a try{} finally {} block. (see IL code below). This is what we expected&lt;br /&gt;
-  &lt;strong&gt;The using(){} statement adds a null check before calling the dispose method inside the finally.&lt;/strong&gt; &lt;br /&gt;
-  The compiler did not add a null check for the TryFinallyTest method (as intented) &lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #bbbbff"&gt;&lt;strong&gt;The Problem:&lt;/strong&gt;&lt;br /&gt;
The &lt;strong&gt;TryFinallyTest method gets disasembeld from IL into C# (or VB) by using a using() statement &lt;/strong&gt;. &lt;br /&gt;
This is not correct because a using() statement has a null check before calling the dispose() method.&lt;br /&gt;
&lt;strong&gt;This means the disasembled C# code does not relfect the IL correctly&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Here is the IL code for the UsingTest() method:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #000000"&gt;.method &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; hidebysig &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;strong&gt;UsingTest()&lt;/strong&gt; cil managed
{
    .maxstack &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;2&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    .locals init (
        [&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;] &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.SqlClient.SqlConnection con,
        [&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;1&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;] &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; CS$&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;4&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;$&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;0000&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)
    L_0000: nop 
    L_0001: newobj instance &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.SqlClient.SqlConnection::.ctor()
    L_0006: stloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    L_0007: nop 
    L_0008: ldloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    L_0009: ldstr &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    L_000e: callvirt instance &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.Common.DbConnection::set_ConnectionString(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)
    L_0013: nop 
    L_0014: nop 
    L_0015: leave.s L_0027
    L_0017: ldloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;     
    L_0018: ldnull  
    L_0019: ceq 
    L_001b: stloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.1&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    L_001c: ldloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.1&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    &lt;strong&gt;L_001d: brtrue.s L_0026    //Nullcheck&lt;/strong&gt;
    L_001f: ldloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    &lt;strong&gt;L_0020: callvirt instance &lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; [mscorlib]System.IDisposable::Dispose()  //dispose call&lt;/strong&gt;
    L_0025: nop 
    L_0026: endfinally 
    L_0027: nop 
    L_0028: ret 
    &lt;strong&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;try&lt;/span&gt;&lt;span class="style1" style="COLOR: #000000"&gt; L_0007 to L_0017 &lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;finally&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; handler L_0017 to L_0027&lt;/strong&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: L_001d: brtrue.s perfoms the null check. In case con is null it jumps directly to the endfinally. This means in case con is null there is no Null Reference Exception&lt;/p&gt;
&lt;p&gt;Here is the IL code for the TryFinallyTest method:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #000000"&gt;.method &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; hidebysig &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;strong&gt;TryFinallytest()&lt;/strong&gt; cil managed
{
    .maxstack &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;2&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    .locals init (
        [&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;] &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.SqlClient.SqlConnection con)
    L_0000: nop 
    L_0001: newobj instance &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.SqlClient.SqlConnection::.ctor()
    L_0006: stloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    L_0007: nop 
    L_0008: ldloc&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; 
    L_0009: ldstr &lt;/span&gt;&lt;span style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    L_000e: callvirt instance &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; [System.Data]System.Data.Common.DbConnection::set_ConnectionString(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)
    L_0013: nop 
    L_0014: nop 
    L_0015: leave.s L_0021
    L_0017: nop 
    &lt;strong&gt;L_0018: ldloc&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #ff0000"&gt;.0&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;   &lt;/span&gt;&lt;span class="style2"&gt;//it loads con and calls directly dispose in the next line. No null check&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
    &lt;strong&gt;L_0019: callvirt instance &lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; [System]System.ComponentModel.Component::Dispose()&lt;/strong&gt;
    L_001e: nop 
    L_001f: nop 
    L_0020: endfinally 
    L_0021: nop 
    L_0022: ret 
    &lt;strong&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;try&lt;/span&gt;&lt;span class="style1" style="COLOR: #000000"&gt; L_0007 to L_0017 &lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;finally&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; handler L_0017 to L_0021&lt;/strong&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Inside the the finally block the IL loads con on the Excution Stack and calls dispose() directly without a null check. In case con is null, an Null Reference Exception is thrown. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So, what to use? Using() or try{} finally{}?&lt;/strong&gt;&lt;br /&gt;
Well, usually I would recommend using Using(), so you don't have to remember the null check. &lt;br /&gt;
But if you have multiple using inside eachother I would rather use one try{} finally{}.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;If you don't know (or if you are too lazy to check)  if your object implements IDisposable you can always use the following pattern to be on the save side:&lt;/p&gt;
&lt;pre&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ObjectAsDispose(SqlConnection con)
{
    &lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span class="style1" style="COLOR: #000000"&gt; (con &lt;/span&gt;&lt;span class="style1" style="COLOR: #0000ff"&gt;as&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;strong&gt; IDisposable)
    {
        con.ConnectionString = &lt;/strong&gt;&lt;/span&gt;&lt;span class="style1" style="COLOR: #800000"&gt;"Test Connection"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;&lt;strong&gt;
    }&lt;/strong&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;I hope you enjoyed this one again. &lt;/p&gt;
&lt;p&gt;Tom&lt;/p&gt;
&lt;p&gt;P.S.: Thanks Ian for reminding me to add the safty pattern for using!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125189"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125189" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/ftom/aggbug/125189.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>ftom</dc:creator>
            <guid>http://geekswithblogs.net/ftom/archive/2008/09/15/c-and-the-using-statement-in-3-seconds-and-a.aspx</guid>
            <pubDate>Mon, 15 Sep 2008 21:03:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/ftom/comments/125189.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/ftom/archive/2008/09/15/c-and-the-using-statement-in-3-seconds-and-a.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/ftom/comments/commentRss/125189.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/ftom/services/trackbacks/125189.aspx</trackback:ping>
        </item>
    </channel>
</rss>