Archive for November, 2007

The Ternary Operator in VB.NET

I think this may be the last operator that I really miss in VB from my curly brace language experience.  Although, I have to admit, I wouldn’t have missed it all that much if they never added it.  There just isn’t a whole lot of use for it.

However, the Ternary operator is a REALLY nice feature to have available to you when you do need it.  It’s another one of those language features that falls under, “Just because it is there doesn’t mean you have to use it.”

If you’ve ever run into a situation where you just need a simple evaluation and assign a variable based on it.  Like this: Read the rest of this entry »

Object Initialization in CSharp 3.0 and VB.NET 9

Yesterday we looked at the new var keyword in CSharp.  This makes CSharp variable declaration similar to VB.  After all, they’ve had the DIM keyword for years which essentially does the same thing.

Today, we’re going to look at object initializers, which have been added to both CSharp and VB.

Read the rest of this entry »

CSharp adds the var keyword!

There have been several new features added to the CSharp language that will significantly reduce the amount of code that ends up in our source files.  It will not significantly reduce the amount of code that we have to write.

One of those language features is the ability to create properties, which we looked at last week.

Another of those features is the new var keyword.

So, instead of writing: Read the rest of this entry »

Intellisense Everywhere in VB 9 (and a small bug)

One of the features the CSharp guys have had for quite a while is Intellisense everywhere.  Want to create a private variable?  Just start typing private and hit the tab key as soon as the word is highlighted.  This, combined with code snippets have made coding in CSharp a bit faster than coding in VB.

What about the VB guys?

Sorry.  All the VB guys got was the ability to see methods an properties hanging off of their objects.  They have had to type out  the whole word for things like public, private, dim and class. 

Until now.  Watch the following video to see the new Intellisense for VB 2008 in action.

Technorati Tags: ,,

  

del.icio.us Tags: ,,

Simple Properties in C# 3.5

It’s such a little thing.  But, how much of our CSharp code looks something like this:

    private string _propertyName;     

    public string PropertyName 
    { 
        get { return _propertyName; } 
        set { _propertyName = value; } 
    }

Read the rest of this entry »

Bear