Attention: We are retiring the ASP.NET Community Blogs. Learn more >

ICompare langugages

Today one of the guys and I were having a conversation about "stuff"; not particularly interesting or relevant but, nonetheless it was "stuff".  Now this was your typical bored-nerd conversation, you know the one:

If Me.IsThirsty OrElse Me.IsHungry Then
    Me.Goto(Fridge)
    Dim coll As Foods = Me.CurrentLocation.GetContents()
    Dim i As Integer
    For Each f As Food In coll
        Me.Consume(f.RawContent)
        If i > 10 Then : Me.Burp() : End If
        i += 1
    Next   
End If   

The main difference between this senseless conversation and all of the other senseless conversations is that we were "psuedo-ing" in different languages.  He was "psuedo-ing" in VB while I was "psuedo-ing" in some wierd, as yet uninvented version of C#.

Now, if you happpen to find yourself having a mixed context conversation then, you'd better keep this link handy ;-)
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrflanguageequivalents.asp

3 Comments

  • I believe there is a bug in your code. The value of i is never reset once it exceeds ten. Therefore, for each piece of food you consume after your tenth item, you will burp. ;)



    --Brian



  • Brian, this feature is by design ;-)

  • There is a potential bug though that didn't show itself until I turned on Option Strict. You should do some type checking when the call to Me.CurrentLocation.GetContents() is made because it returns a collection of type 'object'. Imagine if I was drunk when I made the Goto(Fridge) call and somehow stumbled into the car parking lot. Imagine trying to consume a parking lot full of cars!



    I understand that this will be remedied when Generics comes along!

Comments have been disabled for this content.