c# - GetType() on Array item? -


i have initialised array may contain no items.

lets call a,

calling gettype() on a return type of array. possible type of items array contains?

obviously a[0].gettype() work, array empty , cause null reference exception.

well, can element type of array:

type type = array.gettype().getelementtype(); 

(that's not quite same getting types of items in array - object[] may entirely populated strings, example.)


Comments

Popular posts from this blog

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -