Reason #462 Why I don't like VB.NET:
VB.NET attributes cannot have variable arguments. What do I mean?
The following code does NOT work in VB.NET:
Public Class MyCustomAttribute
Inherits Attribute
Public Sub New(ByVal ParamArray vals() As String)
End Sub
End Class
It compiles, but when you try to use this attribute on a member you’ll get an error: “Attribute constructor argument is a 1-dimension array of string which is not Integral, float, etc…..”
In C# this works perfectly fine. Why is this?
To provide a workaround for this issue I just accept a single pipe-delimited string and .Split it on the pipe to get my array. A tad on the ugly side, but it works.
Now playing: Third Eye Open - Intolerance