I want to get 'array type' of a type at run time. I do not need the instance of the array, just Type. I currently use the below method.
private Type GetArrayType(Type elementType)
{
return Array.CreateInstance(elementType, 0).GetType();
}
Is there any better solution without creating the instance of the array?
Note: I cannot use Type.GetType(elementType.FullName + "[]") because I create the element Type at runtime by Reflection.Emit. According to MSDN it requires dynamic assembly to be saved on disk which I do not want to do.