Monday, September 20, 2010

VB + C# Adventures (Part 3)

I ran into a little hiccup today, which I found amusing.  Parentheses use is very important in C#, whereas in VB you can be lazy about them (think method calls).  In my C# project, I was trying to do an object.ToString.ToUpper, but for some reason Intellisense couldn’t didn’t find ToUpper.  Well, given that ToString is a method call, you need to call it as such: object.ToString().ToUpper().  Has VB made me a lazy developer? :)

Optional parameters… I personally never liked them, but they’re pretty ubiquitous in VB land.  It wasn’t until .NET 4 that C# got this language feature.  VB will let you have optional value and reference parameters, whereas C# won’t let you have optional reference/out parameters.  I’m currently using a data access layer written in VB that has a few methods with optional parameters for my C# project and I saw this first hand through Intellisense.  No brackets were present around the optional reference parameters through C#

No comments: