37 internal struct Record : IRecord
41 internal BlobHandle NativeType;
43 readonly
int IRecord.FilterKey => Parent;
45 public readonly
int CompareTo(Record other) => Comparer<int>.Default.Compare(EncodeHasFieldMarshal(Parent), EncodeHasFieldMarshal(other.Parent));
49 internal const int Index = 0x0D;
53 for (
int i = 0; i < records.Length; i++)
55 records[i].Parent = mr.ReadHasFieldMarshal();
56 records[i].NativeType = MetadataTokens.BlobHandle(mr.ReadBlobIndex());
60 internal override void Write(ModuleBuilder module)
62 for (
int i = 0; i < rowCount; i++)
63 module.Metadata.AddMarshallingDescriptor(
64 MetadataTokens.EntityHandle(records[i].Parent),
65 records[i].NativeType);
68 internal void Fixup(ModuleBuilder moduleBuilder)
70 for (
int i = 0; i < rowCount; i++)
71 records[i].Parent = moduleBuilder.ResolvePseudoToken(records[i].Parent);
76 internal static int EncodeHasFieldMarshal(
int token)
78 return (token >> 24)
switch
80 FieldTable.Index => (token & 0xFFFFFF) << 1 | 0,
81 ParamTable.Index => (token & 0xFFFFFF) << 1 | 1,
82 _ =>
throw new InvalidOperationException(),