Friday, July 13, 2007

Optional Parameters and parameters with default values in VB.NET

It is possible to use an optional parameter in VB.NET that uses a default value as shown below:

Public Function SplitAttrValue(ByVal str As String, ByRef attr As String, ByRef value As String, Optional ByVal delimiter As String = "=") As Boolean

However, here is an article that describes why you should not do this:

Main reason is that C# doesn't support them (you must use overloading).

1 comment:

Anonymous said...

Just a quick note on this old blog entry... C# does now support optional parameters, so the conclusion shown is no longer valid.