From: mp on
Thanks, I'd seen declarations setting to nothing with "regular objects", but
was thinking an array was an array, not an object...
It was cleared up for me that arrays are objects in dot net...i'm slowly
getting that through my thick skull that everyting is an object in dot net.
Thanks for your response
Mark


"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message
news:hpki8s$4vm$1(a)south.jnrs.ja.net...
> On 07/04/2010 19:50, mp wrote:
>
>> how to avoid the compiler warning:
>> Variable 'ArrayObjects' is used before it has been assigned a value. A
>> null
>> null reference exception could result at runtime.
>
>> Dim ArrayObjects() As AcadEntity
>
> The compiler is warning you that this variable /might/ have no value when
> you come to use it.
>
> Avoid this by giving the variable a value - even if that value just
> happens to be a /null/ one!
>
> Dim ArrayObjects As AcadEntity() = Nothing
>
> (I prefer the array braces with the Type, not the Variable - it just reads
> better, IMHO - has the same effect either way).
>
> OK, you /will/ still get a NullReferenceException later on if you don't
> give it another value, but it'll be your all own doing. :-)
>
> HTH,
> Phill W.