本文整理汇总了C#中BlobBuilder.Slice方法的典型用法代码示例。如果您正苦于以下问题:C# BlobBuilder.Slice方法的具体用法?C# BlobBuilder.Slice怎么用?C# BlobBuilder.Slice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlobBuilder
的用法示例。
在下文中一共展示了BlobBuilder.Slice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PdbStream_TypeSystemRowCounts
public void PdbStream_TypeSystemRowCounts()
{
var rowCounts = new int[MetadataTokens.TableCount];
rowCounts[(int)TableIndex.MethodDef] = 0xFFFFFF;
rowCounts[(int)TableIndex.TypeDef] = 0x123456;
var mdBuilder = new MetadataBuilder();
var pdbBuilder = new PortablePdbBuilder(
mdBuilder,
ImmutableArray.Create(rowCounts),
MetadataTokens.MethodDefinitionHandle(0x123456),
_ => new BlobContentId(new Guid("44332211-6655-8877-AA99-010203040506"), 0xFFEEDDCC));
var builder = new BlobBuilder();
pdbBuilder.Serialize(builder);
AssertEx.Equal(new byte[]
{
// PDB ID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0xAA, 0x99, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0xCC, 0xDD, 0xEE, 0xFF,
// EntryPoint
0x56, 0x34, 0x12, 0x06,
// ReferencedTypeSystemTables
0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// TypeSystemTableRows
0x56, 0x34, 0x12, 0x00,
0xFF, 0xFF, 0xFF, 0x00
}, builder.Slice(124, -40));
}
示例2: MetadataVersion_MaxLength
public void MetadataVersion_MaxLength()
{
var version = new string('x', 254);
var mdBuilder = new MetadataBuilder();
mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle));
var rootBuilder = new MetadataRootBuilder(mdBuilder, version);
var builder = new BlobBuilder();
rootBuilder.Serialize(builder, 0, 0);
AssertEx.Equal(new byte[]
{
// padded version length:
0x00, 0x01, 0x00, 0x00,
// padded version:
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00
}, builder.Slice(12, -132));
Assert.Equal(version, ReadVersion(builder));
}
示例3: MetadataVersion
public void MetadataVersion()
{
var version = "\u1234\ud800";
var mdBuilder = new MetadataBuilder();
mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle));
var rootBuilder = new MetadataRootBuilder(mdBuilder, version);
var builder = new BlobBuilder();
rootBuilder.Serialize(builder, 0, 0);
AssertEx.Equal(new byte[]
{
// padded version length:
0x08, 0x00, 0x00, 0x00,
// padded version:
0xE1, 0x88, 0xB4, 0xED, 0xA0, 0x80, 0x00, 0x00,
}, builder.Slice(12, -132));
// the default decoder replaces bad byte sequences by U+FFFD
Assert.Equal("\u1234\ufffd\ufffd", ReadVersion(builder));
}
示例4: MetadataVersion_Default
public void MetadataVersion_Default()
{
var mdBuilder = new MetadataBuilder();
mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle));
var rootBuilder = new MetadataRootBuilder(mdBuilder);
var builder = new BlobBuilder();
rootBuilder.Serialize(builder, 0, 0);
AssertEx.Equal(new byte[]
{
// padded version length:
0x0C, 0x00, 0x00, 0x00,
// padded version:
(byte)'v', (byte)'4', (byte)'.', (byte)'0', (byte)'.', (byte)'3', (byte)'0', (byte)'3', (byte)'1', (byte)'9', 0x00, 0x00,
}, builder.Slice(12, -132));
Assert.Equal(rootBuilder.MetadataVersion, ReadVersion(builder));
}