I've never liked VB.NET. Probably because I was (un)fortunate enough to work with VB6 for 2 years, even though .NET and C# were already there. Nevertheless I'm aware that VB.NET tends to offer some very useful syntax not found in C#.
One thing that I've recently discovered is the ability to specify a "Key Properties" when defining an Anonymous Type.
Syntax for the declaration is more or less as follows:
Dim person = New With {Key .Id = 1, .Name = "John"}
Notice the Key keyword before Id property. Now the interesting thing is that VB.NET compiler generates the Equals method that compares objects for equality, using only the Key Properties as opposed to comparing all properties when code is generated by C# compiler.
Now tell me that VB.NET is slower than C#.
More on the topic can be found on MSDN article on Anonymous Types in VB.NET, in section on Key Properties of course.
Remember Me
a@href@title, strike
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Michal Talaga
E-mail