本文整理汇总了C#中System.Reflection.Metadata.Ecma335.MetadataSizes类的典型用法代码示例。如果您正苦于以下问题:C# MetadataSizes类的具体用法?C# MetadataSizes怎么用?C# MetadataSizes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataSizes类属于System.Reflection.Metadata.Ecma335命名空间,在下文中一共展示了MetadataSizes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializedMetadata
public SerializedMetadata(
MetadataSizes sizes,
BlobBuilder stringHeap,
ImmutableArray<int> stringMap)
{
Sizes = sizes;
StringHeap = stringHeap;
StringMap = stringMap;
}
示例2: GetSerializedMetadata
internal SerializedMetadata GetSerializedMetadata(ImmutableArray<int> externalRowCounts, int metadataVersionByteCount, bool isStandaloneDebugMetadata)
{
var stringHeapBuilder = new HeapBlobBuilder(_stringHeapCapacity);
var stringMap = SerializeStringHeap(stringHeapBuilder, _strings, _stringHeapStartOffset);
Debug.Assert(HeapIndex.UserString == 0);
Debug.Assert((int)HeapIndex.String == 1);
Debug.Assert((int)HeapIndex.Blob == 2);
Debug.Assert((int)HeapIndex.Guid == 3);
var heapSizes = ImmutableArray.Create(
_userStringBuilder.Count,
stringHeapBuilder.Count,
_blobHeapSize,
_guidBuilder.Count);
var sizes = new MetadataSizes(GetRowCounts(), externalRowCounts, heapSizes, metadataVersionByteCount, isStandaloneDebugMetadata);
return new SerializedMetadata(sizes, stringHeapBuilder, stringMap);
}
示例3: SerializeCustomDebugInformationTable
private void SerializeCustomDebugInformationTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
// Note: we can sort the table at this point since no other table can reference its rows via RowId or CodedIndex (which would need updating otherwise).
// OrderBy performs a stable sort, so multiple attributes with the same parent and kind will be sorted in the order they were added to the table.
foreach (CustomDebugInformationRow row in _customDebugInformationTable.OrderBy((x, y) =>
{
int result = (int)x.Parent - (int)y.Parent;
return (result != 0) ? result : MetadataTokens.GetHeapOffset(x.Kind) - MetadataTokens.GetHeapOffset(y.Kind);
}))
{
writer.WriteReference(row.Parent, metadataSizes.HasCustomDebugInformationSize);
writer.WriteReference((uint)GetHeapOffset(row.Kind), metadataSizes.GuidIndexSize);
writer.WriteReference((uint)GetHeapOffset(row.Value), metadataSizes.BlobIndexSize);
}
}
示例4: SerializeImportScopeTable
private void SerializeImportScopeTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (var row in _importScopeTable)
{
writer.WriteReference(row.Parent, metadataSizes.ImportScopeIndexSize);
writer.WriteReference((uint)GetHeapOffset(row.Imports), metadataSizes.BlobIndexSize);
}
}
示例5: SerializeLocalVariableTable
private void SerializeLocalVariableTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (var row in _localVariableTable)
{
writer.WriteUInt16(row.Attributes);
writer.WriteUInt16(row.Index);
writer.WriteReference((uint)GetHeapOffset(row.Name), metadataSizes.StringIndexSize);
}
}
示例6: SerializeMethodDebugInformationTable
private void SerializeMethodDebugInformationTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (var row in _methodDebugInformationTable)
{
writer.WriteReference(row.Document, metadataSizes.DocumentIndexSize);
writer.WriteReference((uint)GetHeapOffset(row.SequencePoints), metadataSizes.BlobIndexSize);
}
}
示例7: SerializeMethodSpecTable
private void SerializeMethodSpecTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (MethodSpecRow methodSpec in _methodSpecTable)
{
writer.WriteReference(methodSpec.Method, metadataSizes.MethodDefOrRefCodedIndexSize);
writer.WriteReference((uint)GetHeapOffset(methodSpec.Instantiation), metadataSizes.BlobIndexSize);
}
}
示例8: SerializeGenericParamTable
private void SerializeGenericParamTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
#if DEBUG
for (int i = 1; i < _genericParamTable.Count; i++)
{
Debug.Assert(
_genericParamTable[i - 1].Owner < _genericParamTable[i].Owner ||
_genericParamTable[i - 1].Owner == _genericParamTable[i].Owner && _genericParamTable[i - 1].Number < _genericParamTable[i].Number);
}
#endif
foreach (GenericParamRow genericParam in _genericParamTable)
{
writer.WriteUInt16(genericParam.Number);
writer.WriteUInt16(genericParam.Flags);
writer.WriteReference(genericParam.Owner, metadataSizes.TypeOrMethodDefCodedIndexSize);
writer.WriteReference((uint)GetHeapOffset(genericParam.Name), metadataSizes.StringIndexSize);
}
}
示例9: SerializeMethodImplTable
private void SerializeMethodImplTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
#if DEBUG
for (int i = 1; i < _methodImplTable.Count; i++)
{
Debug.Assert(_methodImplTable[i - 1].Class <= _methodImplTable[i].Class);
}
#endif
foreach (MethodImplRow methodImpl in _methodImplTable)
{
writer.WriteReference(methodImpl.Class, metadataSizes.TypeDefIndexSize);
writer.WriteReference(methodImpl.MethodBody, metadataSizes.MethodDefOrRefCodedIndexSize);
writer.WriteReference(methodImpl.MethodDecl, metadataSizes.MethodDefOrRefCodedIndexSize);
}
}
示例10: SerializeMethodSemanticsTable
private void SerializeMethodSemanticsTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
// Note: we can sort the table at this point since no other table can reference its rows via RowId or CodedIndex (which would need updating otherwise).
// OrderBy performs a stable sort, so multiple attributes with the same parent will be sorted in the order they were added to the table.
var ordered = _methodSemanticsTableNeedsSorting ? (IEnumerable<MethodSemanticsRow>)_methodSemanticsTable.OrderBy((x, y) => (int)x.Association - (int)y.Association) : _methodSemanticsTable;
foreach (MethodSemanticsRow methodSemantic in ordered)
{
writer.WriteUInt16(methodSemantic.Semantic);
writer.WriteReference(methodSemantic.Method, metadataSizes.MethodDefIndexSize);
writer.WriteReference(methodSemantic.Association, metadataSizes.HasSemanticsCodedIndexSize);
}
}
示例11: SerializePropertyTable
private void SerializePropertyTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (PropertyRow property in _propertyTable)
{
writer.WriteUInt16(property.PropFlags);
writer.WriteReference((uint)GetHeapOffset(property.Name), metadataSizes.StringIndexSize);
writer.WriteReference((uint)GetHeapOffset(property.Type), metadataSizes.BlobIndexSize);
}
}
示例12: SerializePropertyMapTable
private void SerializePropertyMapTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (PropertyMapRow propertyMap in _propertyMapTable)
{
writer.WriteReference(propertyMap.Parent, metadataSizes.TypeDefIndexSize);
writer.WriteReference(propertyMap.PropertyList, metadataSizes.PropertyDefIndexSize);
}
}
示例13: SerializeEventTable
private void SerializeEventTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (EventRow eventRow in _eventTable)
{
writer.WriteUInt16(eventRow.EventFlags);
writer.WriteReference((uint)GetHeapOffset(eventRow.Name), metadataSizes.StringIndexSize);
writer.WriteReference(eventRow.EventType, metadataSizes.TypeDefOrRefCodedIndexSize);
}
}
示例14: SerializeEventMapTable
private void SerializeEventMapTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (EventMapRow eventMap in _eventMapTable)
{
writer.WriteReference(eventMap.Parent, metadataSizes.TypeDefIndexSize);
writer.WriteReference(eventMap.EventList, metadataSizes.EventDefIndexSize);
}
}
示例15: SerializeStandAloneSigTable
private void SerializeStandAloneSigTable(BlobBuilder writer, MetadataSizes metadataSizes)
{
foreach (StandaloneSigRow row in _standAloneSigTable)
{
writer.WriteReference((uint)GetHeapOffset(row.Signature), metadataSizes.BlobIndexSize);
}
}