I\'m have a large list of value types that needs to be given to OpenGL. It would be great if this could happen as quickly as possible. What I\'m doing now looks like this:>
You can do that with reflection:
public static T[] GetUnderlyingArray(this List list)
{
var field = list.GetType().GetField("_items",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
return (T[])field.GetValue(list);
}
edit: ah someone already said it while I was testing this..