<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/"><channel><title>C#</title><link>http://blog.steeleprice.net/category/22.aspx</link><description>C#</description><managingEditor>H. Steele Price, IV</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>H. Steele Price, IV</dc:creator><title>Anonymous Delegates (Methods) and Visual Basic (VB)</title><link>http://blog.steeleprice.net/archive/2006/09/28/914.aspx</link><pubDate>Thu, 28 Sep 2006 16:08:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2006/09/28/914.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/914.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2006/09/28/914.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/914.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/914.aspx</trackback:ping><description>&lt;P&gt;&lt;STRONG&gt;What is an Anonymous Delegate?&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;I have recently been converting these and talking about them quite alot. &lt;/P&gt;
&lt;P&gt;This is a technique not currently implemented in VB, but is used in C# (and other languages) to write some inline code in which I do not want to create classes and handlers to perform some simple operation. Typically this is used in Generics when iterating over a collection, or to execute some specific functionality when an event occurs. &lt;/P&gt;
&lt;P&gt;These are similar to "Closures" in other languages see: &lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/Closure_(computer_science)" target=_blank&gt;http://en.wikipedia.org/wiki/Closure_(computer_science)&lt;/A&gt; &lt;BR&gt;&lt;A href="http://www.martinfowler.com/bliki/Closure.html" target=_blank&gt;http://www.martinfowler.com/bliki/Closure.html&lt;/A&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;OK, so if these are NOT supported in VB, then why as a VB Developer should I care? Specifically, as more and more C# examples using these are posted, there will be an occassion where you really want to use the posted technique and don't quite get how to transalate it into VB. &lt;/P&gt;
&lt;P&gt;There are several way's to work with itteration, so in this sample, I will focus on using delegates for Asynchronous Callbacks such as adding an event listener that performs a set of operations when an event fires. This is a little more difficult to grasp than simple iteration and it also happens to be extremely useful in the event based programming model. &lt;/P&gt;
&lt;P&gt;What does one look like? &lt;/P&gt;
&lt;P&gt;It can be as simple as adding a handler to an event, in C#: &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;PRE class=csharpcode&gt;button1.Click += &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt; {MessageBox.Show(&lt;SPAN class=str&gt;"Hello"&lt;/SPAN&gt;);};&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;So that is the simplified code, lets break it down first in VB terms: &lt;/P&gt;
&lt;P&gt;&lt;B&gt;button1.click&lt;/B&gt; is an event (obviously...) &lt;BR&gt;&lt;B&gt;+=&lt;/B&gt; will add what is inside the delegate{}; block as a new handler, if one (or more) already exists, it will perform this one in the order in which added. In C# the handler is created automatically by the compiler (thus the anonymous part, since we didn't have to give the function a name...) so it is not done manually as we will need to in VB. &lt;/P&gt;
&lt;P&gt;A Click event is oviously radically simplified for realizing the power and usefullness of this coding model. What is cool about an Anonymous Delegate is that you can pass local variables to a set of code that you could not otherwise do in VB. Consider a more real-world example, since I have also been working with System.Transactions: &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=csharpcode&gt;transaction.TransactionCompleted += &lt;SPAN class=kwrd&gt;delegate&lt;/SPAN&gt;
                                    {
                                       &lt;SPAN class=kwrd&gt;lock&lt;/SPAN&gt;(&lt;SPAN class=kwrd&gt;this&lt;/SPAN&gt;)
                                       {
                                          m_PendingTransactions.Remove(pair);
                                       }
                                       &lt;SPAN class=kwrd&gt;lock&lt;/SPAN&gt;(manualEvent)
                                       {
                                          &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt;(manualEvent.SafeWaitHandle.IsClosed == &lt;SPAN class=kwrd&gt;false&lt;/SPAN&gt;)
                                          {
                                             manualEvent.Set();
                                          }
                                       }
                                    };
&lt;/PRE&gt;
&lt;P&gt;This code is admitedlly daunting because it uses 3 uncommon things in VB. First, we are assigning code to a multicast event, secondly we have the use of an Anonymus Delegate, then thirdly we have some Thread Safty being applied. &lt;/P&gt;
&lt;P&gt;So what do I do in VB when I see some sample code in C# that contains things like this? One option you could apply is to fire up &lt;A title="Lutz Roeder's DotNet Reflector" href="http://www.aisto.com/roeder/dotnet/" target=_blank&gt;.Net Reflector&lt;/A&gt; and have a look at what is going on. so, lets do that: &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (handler1 &lt;SPAN class=kwrd&gt;Is&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
    handler1 = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; TransactionCompletedEventHandler(&lt;SPAN class=kwrd&gt;AddressOf&lt;/SPAN&gt; class1.&amp;lt;Lock&amp;gt;b__0)
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;AddHandler&lt;/SPAN&gt; transaction.TransactionCompleted, handler1
&lt;/PRE&gt;
&lt;P&gt;This tends to still be quite cryptic since it uses the compiler created names to describe the functions. It also doesn't help when you are looking at a block of code and don't want to copy/create project/compile it. &lt;/P&gt;
&lt;P&gt;In reviewing this code... what is handler1?, what is class1? and what the heck is this class1.&amp;lt;Lock&amp;gt;b__0) &lt;/P&gt;
&lt;P&gt;Now it starts to get a bit hairy, especially if you don't know C# very well or what the compiler is doing behind the scenes. &lt;/P&gt;
&lt;P&gt;Let me explain what happened here when we look at the Code. Since we do not have Anonymous Delegates in VB, we have to make class1 to hold the State information and the Method (Sub) we want to run, the compiler in C# decided that should be class1 and class1.&amp;lt;Lock&amp;gt;b__0) Next we need to pass in all the state information that the Anonymous Delegate was allowed to just use, now are you starting to see why these things are cool? &lt;/P&gt;
&lt;P&gt;We have to look a little bit higher in the Code to see where that all happens: &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; handler1 &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TransactionCompletedEventHandler = &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; class1 &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; &amp;lt;&amp;gt;c__DisplayClass2
class1.&amp;lt;&amp;gt;4__this = &lt;SPAN class=kwrd&gt;Me&lt;/SPAN&gt;
class1.manualEvent = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; ManualResetEvent(&lt;SPAN class=kwrd&gt;False&lt;/SPAN&gt;)
class1.pair = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; KeyValuePair(Of Transaction, ManualResetEvent)(transaction, class1.manualEvent)
&lt;/PRE&gt;
&lt;P&gt;There is still a bunch of cryptic stuff in here... &lt;/P&gt;
&lt;P&gt;handler1 &lt;BR&gt;&amp;lt;&amp;gt;c__DisplayClass2 &lt;BR&gt;class1.&amp;lt;&amp;gt;4__this &lt;/P&gt;
&lt;P&gt;These also got created by the compiler and just generated the names, so they aren't especially helpful. &lt;/P&gt;
&lt;P&gt;So, when you see this: There are 5 things you need to do to implement this code in VB: 
&lt;OL&gt;
&lt;LI&gt;Make a Private NotInheritable Class with an empty constructor 
&lt;LI&gt;Create Fields to hold each variable 
&lt;LI&gt;Create a Sub that matches the Signature you need to Delegate 
&lt;LI&gt;Perfom the desired functionality inside this Sub, operating on the Class&amp;amp;squot;s Fields 
&lt;LI&gt;Use AddHandler to point to the Class's Sub and run it at the appropriate time &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Let have a look at what the Final cleaned up Code in VB looks like and then go through it. &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;Private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;NotInheritable&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt; TransactionState
    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; tLock &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TransactionalLock
    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; manualEvent &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; ManualResetEvent
    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; pair &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; KeyValuePair(Of Transaction, ManualResetEvent)

    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt;()
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;Public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt; RemoveSelf(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; sender &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Object&lt;/SPAN&gt;, &lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; e &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TransactionEventArgs)
        &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Me&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;SyncLock&lt;/SPAN&gt; .tLock
                .tLock.m_PendingTransactions.Remove(&lt;SPAN class=kwrd&gt;DirectCast&lt;/SPAN&gt;(.pair, KeyValuePair(Of Transaction, ManualResetEvent)))
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;SyncLock&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;SyncLock&lt;/SPAN&gt; .manualEvent
                &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Not&lt;/SPAN&gt; .manualEvent.SafeWaitHandle.IsClosed &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
                    .manualEvent.&lt;SPAN class=kwrd&gt;Set&lt;/SPAN&gt;()
                &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;SyncLock&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Class&lt;/SPAN&gt;

&lt;SPAN class=kwrd&gt;Private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Overloads&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt; Lock(&lt;SPAN class=kwrd&gt;ByVal&lt;/SPAN&gt; transaction &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; Transaction)
    &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (OwningTransaction = &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
        &lt;SPAN class=rem&gt;''' Other stuff&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;Else&lt;/SPAN&gt; 
        &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (OwningTransaction = transaction) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;Return&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;Else&lt;/SPAN&gt; &lt;SPAN class=rem&gt;'Need to lock when different&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; manualEvent &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; ManualResetEvent(&lt;SPAN class=kwrd&gt;False&lt;/SPAN&gt;)
            &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; pair &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; KeyValuePair(Of Transaction, ManualResetEvent)
            &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; tHandler &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; TransactionCompletedEventHandler
            &lt;SPAN class=kwrd&gt;Dim&lt;/SPAN&gt; TranState &lt;SPAN class=kwrd&gt;As&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; TransactionState

            &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt; TranState
                .tLock = &lt;SPAN class=kwrd&gt;Me&lt;/SPAN&gt;
                .manualEvent = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; ManualResetEvent(&lt;SPAN class=kwrd&gt;False&lt;/SPAN&gt;)
                .pair = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; KeyValuePair(Of Transaction, ManualResetEvent)(transaction, .manualEvent)
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;With&lt;/SPAN&gt;

            &lt;SPAN class=rem&gt;''' Other stuff&lt;/SPAN&gt;
            &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (transaction IsNot &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
                &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt; (tHandler &lt;SPAN class=kwrd&gt;Is&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;Then&lt;/SPAN&gt;
                    tHandler = &lt;SPAN class=kwrd&gt;New&lt;/SPAN&gt; TransactionCompletedEventHandler(&lt;SPAN class=kwrd&gt;AddressOf&lt;/SPAN&gt; TranState.RemoveSelf)
                &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
                &lt;SPAN class=kwrd&gt;AddHandler&lt;/SPAN&gt; transaction.TransactionCompleted, tHandler
            &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
            &lt;SPAN class=rem&gt;''' other stuff&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;If&lt;/SPAN&gt;
&lt;SPAN class=kwrd&gt;End&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;Sub&lt;/SPAN&gt;
&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;First for the renaming of what we saw in Reflector: &lt;/P&gt;
&lt;P&gt;class1 = TranState &lt;BR&gt;handler1 = tHandler &lt;BR&gt;&amp;lt;&amp;gt;c__DisplayClass2 = TransactionState &lt;BR&gt;.&amp;lt;&amp;gt;4__this = tLock &lt;BR&gt;and &lt;BR&gt;.&amp;lt;Lock&amp;gt;b__0= .RemoveSelf &lt;/P&gt;
&lt;P&gt;Now let see what we had to do: &lt;/P&gt;
&lt;P&gt;First we have to create a Named Class that does what the delegate does, this is Class TransactionState. Next inside that class, we need to create fields to hold all the state information for the state of the variables when we instantiate the Class. &lt;/P&gt;
&lt;P&gt;Armed with the Class we can now instantiate the Class, Populate the Fields with our Variables then Add an new Handler that listens for the TransactionCompleted Event and runs the Sub in the Class when it fires. &lt;/P&gt;
&lt;P&gt;As you can see just from the amount of code, having Anonymous Delegates in VB would make this drastically simpler to implement, however it IS indeed possible to convert this code to VB with a little work and the understanding of what is going on. I do these types of Classes already so it was not a huge surprise to see the functionality, but what really surprised me was how much easier it could be when we get Anonymous Delegates to shortcut the whole idea. &lt;/P&gt;
&lt;P&gt;There are many of us fighting hard to have Anonymous Delegates in VB9, but it unfortunately may be too late and we might have to wait until VB10, that would be extremely dissapointing since we are going to get something called a Lambda Expression in VB9 that is fairly close (part of LINQ, a one line quick expression) but certainly not as powerful as a full inline function. &lt;/P&gt;
&lt;P&gt;If C# has them, the compiler knows how to create them, so it should not be a huge task to actually include it, but I am not on the VB Design team so I really don't know what it would take inside the compiler and parsers to provide it to VB. Hopefully we will see them soon as a natural part of the evolving VB.NET Language and when we need to convert some C# code into something more useful for our VB Projects, we will not have to be so verbose. &lt;/P&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/914.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>C# Narrowly makes Top 10 while VB hails at #4</title><link>http://blog.steeleprice.net/archive/2004/11/29/436.aspx</link><pubDate>Mon, 29 Nov 2004 10:52:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/11/29/436.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/436.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/11/29/436.aspx#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/436.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/436.aspx</trackback:ping><description>&lt;P&gt;The &lt;A target ="_blank" href="http://www.tiobe.com/tiobe_index/tekst.htm"&gt;TIOBE Programming Community Index for November&lt;/A&gt; shows that VB is still more popular than C# by a Very Wide margin, though you wouldn't know that if you listen to Microsoft and most of the DotNet community.&lt;/P&gt;
&lt;P&gt;It's not that I am against using C# at all, it's just that when it comes to real world popularity C# still has a long way to go to gain on the installed base of developers that actually use the language.&lt;/P&gt;
&lt;P&gt;Despite Microsoft pushing the language on everyone as a &amp;#8220;more efficient and capable&amp;#8220; language it, like any language has its shortcomings.&amp;nbsp; What I think would really be nice is a way to make regular C just as easy to use in Rapid Application development as any of the other DotNet Languages.&amp;nbsp; If that were the case, the popularity of C# would dwindle even further down the list.&lt;/P&gt;
&lt;P&gt;It's quite impressive that any new language can even make the top ten in the first 5 years of its release, but without widespread support from the Open Source community, it's interesting to see just how far ahead VB really is to C#.&lt;/P&gt;
&lt;P&gt;Remove the Open Source Languages and you have VB, Delphi then C# as the contenders for the top crown in Microsoft OS driven languages.&amp;nbsp; I also find it interesting that they separated C from C++ when the bulk of the real applications are a combination of the two and together represent over 20% of the entire pool.&lt;/P&gt;
&lt;P&gt;C/C++ is still the clear winner of all languages with Java and VB running a fairly close race for second.&lt;/P&gt;
&lt;P&gt;If VB had the Open Source push that Java gets would there be any doubt who the real winner would be for ease of use and popularity in development?&lt;/P&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/436.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>C# Misinformation about VB, yet again.</title><link>http://blog.steeleprice.net/archive/2004/07/12/361.aspx</link><pubDate>Mon, 12 Jul 2004 16:41:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/07/12/361.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/361.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/07/12/361.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/361.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/361.aspx</trackback:ping><description>&lt;P&gt;&lt;FONT color=#ff0000&gt;Update&lt;/FONT&gt;: somehow I missed these threads when I posted...&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;A id=viewpost.ascx_TitleUrl href=http://weblogs.asp.net/cfranklin/archive/2004/07/12/181125.aspx target=_blank&gt;&lt;FONT color=#800080&gt;A well-deserved smack back to some C# zealotry&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A class=TitleLinkStyle href="http://www.shitalshah.com/blog/PermaLink.aspx?guid=ea881384-4413-41d3-9c9c-0796fcad09da" target=_blank&gt;&lt;FONT color=#800080&gt;Why VB.Net Is Better Than C#&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A class=singleposttitle id=_ctl0__ctl2_TitleUrl href="http://neopoleon.com/blog/posts/7148.aspx" target=_blank&gt;&lt;FONT color=#800080&gt;Language wars (sigh)&lt;/FONT&gt;&lt;/A&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I really share Eric's sentiments here, but I however, will comment...&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Sorry if whoever's doing this reads my blog, but personally I think a lot of the stuff on your list is really silly.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;A href="http://www.elegancetech.com/CSVB_WhyConvert.aspx" target=_blank&gt;C-Sharpener For VB - Why Switch?&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;I&gt;[Via &lt;A href="http://weblogs.asp.net/eporter/archive/2004/07/12/180951.aspx" target=_blank&gt;HumanCompiler - Erik Porter (MS MVP) Blog&lt;/A&gt;]&lt;/I&gt; 
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;On a point by point basis, why this list annoys the heck out of me, and makes the list itself outrageous to seasoned VB developers. &lt;/P&gt;
&lt;P&gt;The "For the Developer list" &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;maybe, the average is perhaps biased, It's not like you will make more money just for developing in C#. Quality code is Quality code no matter what the language. 
&lt;LI&gt;C# is no more elegant looking than VB, PERIOD. 
&lt;LI&gt;C# is closer to java, so what? I don't program in java unless I am forced to and that is extremely rare.&amp;nbsp;&amp;nbsp; In fact I use DotNet to specifically avoid Java altogether. 
&lt;LI&gt;VB is perceived as a "toy" language. ONLY BECAUSE OF MISREPRESENTATIONS LIKE THIS STUPID LIST! 
&lt;LI&gt;Bah, show me ONE Microsoft person besides Anders that will publicly admit to this. 
&lt;LI&gt;First&amp;nbsp;point is addressed in Whidbey, 2nd addressed with nDoc, 3rd who cares, if you want unsafe code you probably wouldn't write it in C# anyway, you can't (at least shouldn't) write a hardware driver in C#. 
&lt;LI&gt;um, all those are the next release of VB too, not just C#.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The "For the Manager Section" &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;your code won't magically improve by switching to C#.&amp;nbsp; If this statement actually had any merit, we would all be programming in &lt;A href="http://www.adahome.com/articles/1998-07/nw_adarecommended.html" target=_blank&gt;ADA&lt;/A&gt;. 
&lt;LI&gt;VB is 3x more productive for me than C# and the main reason I don't switch primary development to it, besides that, I just don't like&amp;nbsp;C style syntax, in C#, C++ OR Java, I don't care how many people love it, I don't. 
&lt;LI&gt;this is PURE crap, if it's mixed, its mixed, you can switch all the C# to VB just as easily, if not MORE easily without codegen. 
&lt;LI&gt;so what, we aren't using DotNet for portability, and Mono can compile VB anyway. 
&lt;LI&gt;ECMA doesn't make syntax any more standards stable&amp;nbsp;than anything else from Microsoft. 
&lt;LI&gt;LIE, flat out LIE... anything they sell is written in C++. 
&lt;LI&gt;both points are totally moot to MOST development efforts and point #1 is solved completely with nDoc.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Lists like this remind me of &lt;A href="http://fahrenheit_fact.blogspot.com/" target=_blank&gt;idiots promoting rumor and inuendo as facts&amp;nbsp;that must be refuted by sites like this.&lt;/A&gt;&lt;/P&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/361.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>Proof C# code can be written just as poorly as VB code</title><link>http://blog.steeleprice.net/archive/2004/07/06/342.aspx</link><pubDate>Tue, 06 Jul 2004 00:04:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/07/06/342.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/342.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/07/06/342.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/342.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/342.aspx</trackback:ping><description>As &lt;A href="http://sandspace.com/blog/posts/278.aspx" target=_blank&gt;John Sands points out so eloquently&lt;/A&gt;, some people just shouldn't write code, no matter what language they use. I wonder what the Whiz means in Whizlabs...&lt;img src ="http://blog.steeleprice.net/aggbug/342.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>Comments show alot of C# Snobbery</title><link>http://blog.steeleprice.net/archive/2004/07/05/341.aspx</link><pubDate>Mon, 05 Jul 2004 23:57:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/07/05/341.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/341.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/07/05/341.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/341.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/341.aspx</trackback:ping><description>&lt;p&gt;
&lt;a href="http://weblogs.asp.net/hpreishuber/archive/2004/07/05/173067.aspx"&gt;In this JOKE posting&lt;/a&gt;,  Hannes lets C# developers demonstrate their complete snobbery through their inane comments.
&lt;/p&gt;&lt;p&gt;
This reminds me of the bitterness shown by the Delphi crowd towards VB Developers 10 years ago and the monotonous whining of the Java camps.
&lt;/p&gt;
&lt;blockquote&gt;Bill Gates himself changed the Whidbey roadmap and brings back the focus on VB. The development language which is part of the Microsoft success. They stopped all their activity and rewrite everything in VB.NET. I give you the opportunity to share this very secret information. Read the whole story!
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
The actual point here is: Why the heck should anyone care &lt;i&gt;WHAT&lt;/i&gt; language its written in as long as it is well written and provides the desired functionality.  Language snobbery belongs to the French, it plays a very unimportant role in technology.  &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;841927" target="_blank"&gt;Microsoft says you shouldn't write core OS processes in C# either&lt;/a&gt; so there... all important code should be written only in C/C++.
&lt;/p&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/341.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>Curly Braces Begone!</title><link>http://blog.steeleprice.net/archive/2004/06/15/310.aspx</link><pubDate>Tue, 15 Jun 2004 10:05:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/06/15/310.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/310.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/06/15/310.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/310.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/310.aspx</trackback:ping><description>&lt;P&gt;Hehehe, &lt;/P&gt;
&lt;P&gt;&lt;A href="http://thedailywtf.com/archive/2004/06/14/294.aspx"&gt;This is an interesting way to dump curly braces&lt;/A&gt; if you absolutely can't stand them.&lt;/P&gt;
&lt;P&gt;a lot of VB Coders just despise the whole idea. Code formatting isn't preventing me from making a transition to C#, what prevents me from making the transition is the peculiarities of Visual Studio with regard to C#, no background compiling, etc.&lt;/P&gt;
&lt;P&gt;I just find myself more productive working in the sometimes nagging intellisense of VB, I tend to make fewer mistakes and get more accomplished in a shorter amount of time.&amp;nbsp; Yes VB allows you to write really poor code, but so does any other language, I don't buy that as an excuse not to use VB.&amp;nbsp; With Whidbey on the way (and my ability to start coding under Whidbey almost exclusively in a few months) I see even less of a reason to transition.&amp;nbsp;&amp;nbsp;Since 'Generics' and 'Using' were the only things I really wanted from C# that reason has evaporated because they are going to be in VB.&lt;/P&gt;
&lt;P&gt;With Codesmith and other tools like it supporting VB why bother going to C#.&amp;nbsp; If someone can give me a real reason, I'm all for listening, but its going to take alot more than an opinion to get me to change over.&lt;/P&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/310.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>AnkhSVN</title><link>http://blog.steeleprice.net/archive/2004/02/03/152.aspx</link><pubDate>Tue, 03 Feb 2004 13:03:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2004/02/03/152.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/152.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2004/02/03/152.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/152.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/152.aspx</trackback:ping><description>&lt;P&gt;Have I mention &lt;A href="http://ankhsvn.tigris.org"&gt;AnkhSVN&lt;/A&gt; lately?&amp;nbsp; If not there is a new version 0.4.1 available.&lt;/P&gt;
&lt;P&gt;Also, added &lt;A href="http://ankhsvn.com/blog/"&gt;Arild's Blog&lt;/A&gt; to links.&lt;/P&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/152.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>H. Steele Price, IV</dc:creator><title>New Blog System</title><link>http://blog.steeleprice.net/archive/2003/10/28/125.aspx</link><pubDate>Tue, 28 Oct 2003 11:01:00 GMT</pubDate><guid>http://blog.steeleprice.net/archive/2003/10/28/125.aspx</guid><wfw:comment>http://blog.steeleprice.net/comments/125.aspx</wfw:comment><comments>http://blog.steeleprice.net/archive/2003/10/28/125.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blog.steeleprice.net/comments/commentRss/125.aspx</wfw:commentRss><trackback:ping>http://blog.steeleprice.net/services/trackbacks/125.aspx</trackback:ping><description>&lt;p&gt;I have officially converted this blog from &lt;a href="http://www.drupal.org"&gt;Drupal &lt;/a&gt;on Linux to &lt;a href="http://scottwater.com/dottext"&gt;DotText &lt;/a&gt;on Windows.&lt;/p&gt;
&lt;p&gt;I had a small amount of trouble getting it to work right in a subdomain, but it's all functioning correctly now (I think).&lt;/p&gt;
&lt;p&gt;I had to make some small edits to the code to accomodate my hosting service (it just needed a try/catch block for the configure page) because it didn't want to load correctly with an Empty Application name since null is not allowed I wasn't sure what to do here so the try/catch just ignores the error when it tries to load the appname for editing now.&lt;/p&gt;
&lt;p&gt;Creating the skin was not too bad, it's just a bunch of css and some tricks I use with images, the mcp logo is actually in the tagline :-)  I could have edited a control to float it around, but why bother when css works just fine.  I also didn't bother renaming leftmenu even though it's on the right, because I didn't want to recode the controls.  This is based on the Hover skin with colors and some other things changed.  If anyone wants to see what I did, email me.&lt;/p&gt;
&lt;p&gt;I tested the CSS in Firebird as well as IE but I don't know how graceful it will downgrade to others, I don't really care either, anything less than a version 6 browser and you can just go upgrade... or suffer.&lt;/p&gt;
&lt;p&gt;I need to figure out how DotText can use a summary for display on the front page, I thought it would just use the Description/Excerpt field, but it doesn't.  Now that I officially have it up and running I can mess with it whenever I have some free time.&lt;/p&gt;
&lt;p&gt;Converting over the nodes from drupal took some tweaking, thank goodness I only had a couple dozen entries, anything with code had to be html cleaned because it was running the code, that not quite safe and probably needs a filter added in the code..&lt;/p&gt;&lt;img src ="http://blog.steeleprice.net/aggbug/125.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>