if (type.GetCustomAttribute<InlineArrayAttribute>() is { } inlineAttr) { Delegate helper = inlineHelper<int, int>; MethodInfo helperMethod = helper.Method.GetGenericMethodDefinition().MakeGenericMethod(type, fields.Single().FieldType); return helperMethod.Invoke(helper.Target, [o, inlineAttr.Length]); } TArray inlineHelper<TArray, TField>(TArray array, int length) { Span<TField> span = MemoryMarshal.CreateSpan(ref Unsafe.As<TArray, TField>(ref array), length); for (int i; i < length; i++) span[i] = (TField)visit(span[i]); return array; }
List<T>
Type
default(T)
IsTrue
MyItem
Checkbox.IsChecked
<DataTemplate DataType="{x:Type local:ItemViewModel}">