Tinister
Tinister
CC#
Created by Tinister on 6/4/2024 in #help
Reflection with InlineArrayAttribute?
If I have an 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>()?.Length And 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.
20 replies