Reflection with InlineArrayAttribute?
If I have an
I can get the length with
And I can get its field with
But using
object o that I know is a struct with InlineArrayAttribute, how would I go about getting/setting each of the items?I can get the length with
o.GetType().GetCustomAttribute<InlineArrayAttribute>()?.LengthAnd I can get its field with
o.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Single()But using
fieldInfo.GetValue/fieldInfo.SetValue seems to only get/set the item at index 0 in the array.