当前位置: 首页>>代码示例>>C#>>正文


C# BlobBuilder.Slice方法代码示例

本文整理汇总了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));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:34,代码来源:PortablePdbBuilderTests.cs

示例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));
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:38,代码来源:MetadataRootBuilderTests.cs

示例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));
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:24,代码来源:MetadataRootBuilderTests.cs

示例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));
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:21,代码来源:MetadataRootBuilderTests.cs


注:本文中的BlobBuilder.Slice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。