Udostępnij za pośrednictwem


VB for C# Developers

The lack of C# expressions in WF 4.0 is painful for all of you C# developers out there. We know, and we won’t forget about C# support when planning for future releases. However, if you are using WF 4.0, you will need to figure out how to cope with VB for now, so here are some resources to help you do so.

VB is a powerful language and it has many language features that a C# developer would expect. It does, however, have some different keywords and operators. It also has different mindset that takes some getting used to.

A good starting point is this intro post for C# developers by Kathleen Dollard. Not all of these tips and tricks will be applicable in the workflow. There are some inherent limitations in the designer because it is an expression editor, not a statement editor, and everything entered into the box must be evaluated to an expression tree. A list of limitations will be the subject of another post.

This intro was written for VB 9.0. There are a couple of improvements for VB 10.0 that are very useful.

Line continuation characters (underscores) are no longer required, so long as your expression can unambiguously be interpreted by the compiler as a single expression. For example,

True Or

False

is valid but

True

Or False

is not.

Collection initializer syntax has also been improved, you’ll see some examples of collection initializers in the next post.

Comments

  • Anonymous
    November 27, 2011
    The comment has been removed