What features are heavily used in C# 2.0, but is not available in VBNET 2.0, and how to workaround?

Posted by Will Marcouiller on Stack Overflow See other posts from Stack Overflow or by Will Marcouiller
Published on 2010-05-14T15:17:11Z Indexed on 2010/05/14 15:24 UTC
Read the original article Hit count: 236

Filed under:
|
|

I don't want a war between VBNET and C# developpers, neither is my goal to open a C# VS VBNET confrontation.

I would like you all to list a feature that is heavily used in C#, but is not available in VBNET 2.0, and how would you work around to achieve a similar behaviour or purpose?

For example:

C#

Accepts void (return) lambda expressions. Here's an example with FNH mapping:

Component(x => x.Address, m => { 
    m.Map(x => x.Number); 
    m.Map(x => x.Street); 
    m.Map(x => x.PostCode); 
});

This is impossible to do before VBNET 4.0 (supposed to be doable in VBNET 4.0)

VBNET

Must write a helping method (Sub), and provide the AddressOf this method in order to workaround.

Private Sub Helper(ByVal m As MType) 
    m.Map(Function(x) x.Number) 
    m.Map(Function(x) x.Street) 
    m.Map(Function(x) x.PostCode) 
End Sub 

...   
Component(Function(x) x.Address, AddressOf Helper) 

Now I know, it is not VBNET 2.0, but this is an example. VBNET 3.0 and 3.5 can used too. Please just mention what version of VBNET this refers to.

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb.net