本文整理汇总了C#中Microsoft.Cci.BlobBuilder.LinkSuffix方法的典型用法代码示例。如果您正苦于以下问题:C# BlobBuilder.LinkSuffix方法的具体用法?C# BlobBuilder.LinkSuffix怎么用?C# BlobBuilder.LinkSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Cci.BlobBuilder
的用法示例。
在下文中一共展示了BlobBuilder.LinkSuffix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Link
public void Link()
{
var builder1 = new BlobBuilder(16);
builder1.WriteByte(1);
var builder2 = new BlobBuilder(16);
builder2.WriteByte(2);
var builder3 = new BlobBuilder(16);
builder3.WriteByte(3);
var builder4 = new BlobBuilder(16);
builder4.WriteByte(4);
var builder5 = new BlobBuilder(16);
builder5.WriteByte(5);
builder2.LinkPrefix(builder1);
AssertEx.Equal(new byte[] { 1, 2 }, builder2.ToArray());
Assert.Throws<InvalidOperationException>(() => builder1.ToArray());
Assert.Throws<InvalidOperationException>(() => builder2.LinkPrefix(builder1));
Assert.Throws<InvalidOperationException>(() => builder1.WriteByte(0xff));
Assert.Throws<InvalidOperationException>(() => builder1.WriteBytes(1, 10));
Assert.Throws<InvalidOperationException>(() => builder1.WriteBytes(new byte[] { 1 }));
Assert.Throws<InvalidOperationException>(() => builder1.ReserveBytes(1));
Assert.Throws<InvalidOperationException>(() => builder1.GetBlobs());
Assert.Throws<InvalidOperationException>(() => builder1.ContentEquals(builder1));
Assert.Throws<InvalidOperationException>(() => builder1.WriteUTF16("str"));
Assert.Throws<InvalidOperationException>(() => builder1.WriteUTF8("str", allowUnpairedSurrogates: false));
builder2.LinkSuffix(builder3);
AssertEx.Equal(new byte[] { 1, 2, 3 }, builder2.ToArray());
Assert.Throws<InvalidOperationException>(() => builder3.LinkPrefix(builder5));
builder2.LinkPrefix(builder4);
AssertEx.Equal(new byte[] { 4, 1, 2, 3 }, builder2.ToArray());
Assert.Throws<InvalidOperationException>(() => builder4.LinkPrefix(builder5));
builder2.LinkSuffix(builder5);
AssertEx.Equal(new byte[] { 4, 1, 2, 3, 5 }, builder2.ToArray());
}
示例2: LinkSuffix1
public void LinkSuffix1()
{
var builder1 = new BlobBuilder(16);
builder1.WriteByte(1);
builder1.WriteByte(2);
builder1.WriteByte(3);
var builder2 = new BlobBuilder(16);
builder2.WriteByte(4);
builder1.LinkSuffix(builder2);
AssertEx.Equal(new byte[] { 1, 2, 3, 4 }, builder1.ToArray());
}