Visual Basic Blog

A group blog from members of the VB team

The many cases of ByRef

One of the overlooked or simply misunderstood features of the VB language is calling a function which has a ByRef parameter.  Most languages support only a single method of passing parameters by reference [1], that is the scenarios directly supported by the CLR.  The CLR has a lot of restrictions on the type of values it supports for...

Community Interview with Jared Parsons (Beth Massi)

Here's another community interview from our Italian Visual Basic MVP Alessandro Del Sole, this time with Jared Parsons, a Developer on the VB Team. Jared is a great developer and loves the community. You can check out his personal blog here.You can also check out the Visual Basic Team page for pictures and bios and visit the home page of the ...

VB Catch … When: Why so special?

The VB Catch syntax has a unique feature: When.  It allows users to filter expressions based on something other than their type.  Any arbitrary code can enter a When block to decide whether or not to handle an Exception. Newsgroups often ask, "Why's this so special? I could effectively get the same behavior out of C# by doing the ...

PInvoke Interop Assistant on CodePlex (Jared Parsons)

I'm happy to announce that the PInvoke Interop Assistant tool is now available on CodePlex.  This includes the binaries, source code and the dev authored unit tests.  It is hosted on the more general CLR Interop Tools page.  http://www.codeplex.com/clrinterop I will be actively maintaining this tool in the future and (hopefully...

Making PInvoke Easy

Jared here again.  I very excited to announce we recently released a tool I've been working on to MSDN that will greatly help with using PInvoke in managed code.  The tool is called the "PInvoke Interop Assistant" and is included as part of a MSDN article on marshalling data for PInvoke and Reverse PInvoke scenarios.  Here is ...

Customizing Displays in the Debugger for System Types

We've heard feedback from several customers regarding the way certain types are displayed in the Debugger.  Many of the displays exist to maintain the user experience between versions of Visual Studio.  We constantly evaluate if this is the correct choice for a given version of the product.  Starting with VS2008, you don't have ...

Closures in VB Part 5: Looping

For previous articles in the series please see Once again sorry for the long delay between posts.  Looping structures can cause unintended consequences when used with Lambda expressions.  The problem occurs because lambda expressions do not execute when they are constructed but rather when they are invoked.  For example take ...

Closures in VB Part 4: Variable Lifetime

For previous articles in this series please see Sorry for the long delay between posts here.  We're getting Orcas out the door and getting this series completed takes a back seat to shipping.  Originally I wanted to talk about looping structures next.  However when I started writing that post I realized that I had to talk ...

Closures in VB Part 3: Scope

Jared here again.  For previous articles in this series please see Thus far in the series we've only lifted variables that are declared in the same block/scope. What happens if we lift variables in different scope?  The answer is that one closure class will be created for every unique scope where a lifted variable is declared ...