Action(Of T) Lambdas in VB

March 30th, 2009 by ryan Leave a reply »

Until VB catches up with C# in the lambda support realm, here is how you can accomplish those Moq or Rhino.Mocks style verifications in VB:

dim someSub as Action(Of double) = AddressOf mockObject.SomeSub

Rhino.Mocks.Expect.Call( someSub)

It’s very frustrating going from the full support in C# to VB, but I’m finding sufficient workaround for most items.  I shouldn’t be so hard on VB.  C# doesn’t support inline of Xml which is pretty friggin’ sweet.

Advertisement

1 comment

  1. cromwellryan says:

    After seeing that title again, it should say “kinda”. These are obviously not lambda expressions, but simply a way to take advantage of some of the nice support for delegate invokation in some Mocking Frameworks.

Leave a Reply