Archive forOctober, 2007

VB 10 thoughts (part 5)

  a NameOf operatoryou could use this similar to TypeOf, but to get the name of a class or a method or property etc. NameOf could be used :– without any operand to return the name of the current method/property, e.g NameOf()– using an object reference ot get a typename, e.g NameOf(Me) gives the name […]

Click here to read more »

VB 10 thoughts (part 4)

still teasing out thoughts from the cobwebs Date literalstoday in VB you can only specify date literals in the format of #MM/dd/yyyy#That’s incredibly USA centric. I’d like to input date literals in the form of dd/MM/yyyy, but because that would cause an ambiguity, I’d really like to see dd MMM yyyy, or failing that the […]

Click here to read more »

Inline casting

I wrote a couple of really simple extension methods, Cast, and TryCast, that allow me to write code such as sender.Cast(Of Control).Text = “hello world” <Extension()> _ Function Cast(Of T)(ByVal obj As Object) As T Return DirectCast(obj, T) End Function <Extension()> _ Function [TryCast](Of T As Class)(ByVal obj As Object) As T Return TryCast(obj, T) […]

Click here to read more »

VB 10 thoughts (part 3)

More language thoughts for VB10 (see part1 and part2 for earlier posts) Delegate combining and removing syntaxToday in VB if you write a Custom Event handler, you have to write some really long winded code to combine and remove delegates, such as :Custom Event Click As EventHandler   AddHandler(ByVal value As EventHandler)      m_ClickEventHandler = DirectCast([Delegate].Combine(m_ClickEventHandler, value), […]

Click here to read more »

VB 10 thoughts (part 2)

Continuing thoughts on the language from yesterday : Multiple assignment Todd suggested this yesterday in reply to my post.  I don’t like the use of the := syntax, rather I’d like to see a grouping used, such as :(x, y) = 5That would be the equivalent of x = 5 : y = 5  Differentiate […]

Click here to read more »

VB 10 thoughts …

Paul Vick has started the conversation about VB 10 features and thoughts.  Off the top of my head in no particular order here’s some things I’d like to see in the language: complete Optional parametersOptional parameters are one of my favorite features but there’s a couple of problems with them. First you can’t overload by […]

Click here to read more »

« Previous Page