Public Function SomeMethod Dim pos As Integer If <<Some Condition>> Then pos = 1 End If myCol.Add myOjb, myKey, Before:=pos End Function
pos
If <<Some Condition>> Then myCol.Add myOjb, myKey, Before:=1 Else myCol.Add myOjb, myKey End If
Public Function SomeMethod(Optional ByVal pos As Integer = 1) myCol.Add myOjb, myKey, Before:=pos End Function
MSDN wrote:Before Optional. An expression that specifies a relative position in the collection. The element to be added is placed in the collection before the element identified by the Before argument. If Before is a numeric expression, it must be a number from 1 through the value of the collection's Count Property (Collection Object). If Before is a String expression, it must correspond to the key string specified when the element being referred to was added to the collection. You cannot specify both Before and After.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)