Vixen
02b45cc4
csharp
public sealed class ReflectedMember

A member the serialization generator described, drawn by the inspector.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ Writing through a boxed struct works, and it only works because the generator went out of its way. The obvious setter — ((Foo) instance).X = value — unboxes into a temporary and the language will not even compile the assignment; a version that got past the compiler would write to a copy and silently do nothing. TypeDescriptorGenerator emits Unsafe.Unbox<Foo>(instance), which is a reference into the box itself, so a component read out of a chunk can be edited in place and written back whole.

Boxing is the point rather than a cost here. This is the tooling path — one allocation per property read, against a panel somebody is looking at — which is the trade Vixen.Core.Reflection's own remarks name. Frame code touches the field.

Fields and properties (3)

  • public override Type MemberType

    What it holds.

  • public override Type OwnerType

    What it belongs to.

  • public override bool CanWrite

    Whether it can be written at all, condition and read-only flag aside.

Methods (4)

  • public ReflectedMember(Type owner, MemberDescriptor member)

    Describes a member from its serialization descriptor.

  • public override object? GetBoxed(object owner)

    Reads it, boxing a value type.

  • public override void SetBoxed(object owner, object? value)

    Writes it, unboxing a value type.

  • public override IEditorCommand CreateSetCommand(IReadOnlyList<object> targets, object? value, EditorDocument? document)

Used by (1)

  • ReflectedDescriptorVixen.Editor.Inspector