Ok this is new.
Very simple code right? Problem is if my Array is derived from a Non .NET type say someClassA it can't infer the data type. Why does it treat objects as a unique type other then a generic?
Gives me an error. TypeMismatch via Objects?
VB.NET:
Public Sub AddToArray(ByRef ArrayOf() As Object, ByVal Obj As Object)
If ArrayOf Is Nothing Then
ReDim ArrayOf(0)
Else
ReDim Preserve ArrayOf(ArrayOf.Length)
End If
ArrayOf(ArrayOf.Length - 1) = Obj
End sub
Very simple code right? Problem is if my Array is derived from a Non .NET type say someClassA it can't infer the data type. Why does it treat objects as a unique type other then a generic?
VB.NET:
Dim MyArray() of SomeClassA
Dim ANewObj of SomeClassA
.
. Do something to ANewObj
.
AddToArray(MyArray, ANewObj)
Gives me an error. TypeMismatch via Objects?