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


C# BinaryWriter.WriteNumberMostlyBelow255方法代码示例

本文整理汇总了C#中System.IO.BinaryWriter.WriteNumberMostlyBelow255方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteNumberMostlyBelow255方法的具体用法?C# BinaryWriter.WriteNumberMostlyBelow255怎么用?C# BinaryWriter.WriteNumberMostlyBelow255使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.BinaryWriter的用法示例。


在下文中一共展示了BinaryWriter.WriteNumberMostlyBelow255方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveArray

 private static void SaveArray(IList list, BinaryWriter writer)
 {
     writer.WriteNumberMostlyBelow255(list.Count);
     if (list.Count == 0)
         return;
     if (AreAllElementsTheSameType(list))
         SaveArrayWhenAllElementsAreTheSameType(list, writer);
     else
         SaveArrayWhenAllElementsAreNotTheSameType(list, writer);
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:10,代码来源:BinaryDataSaver.cs

示例2: GetTestBytesWithLengthHeader

		public static byte[] GetTestBytesWithLengthHeader(int numberOfWishedTestBytes)
		{
			var data = new MemoryStream();
			var writer = new BinaryWriter(data);
			writer.WriteNumberMostlyBelow255(numberOfWishedTestBytes);
			writer.Write(false);
			for (int num = 0; num < numberOfWishedTestBytes; num++)
				writer.Write((byte)(100 + num));
			return data.ToArray();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:DataCollectorTests.cs

示例3: SaveDictionary

		private static void SaveDictionary(IDictionary data, BinaryWriter writer)
		{
			writer.WriteNumberMostlyBelow255(data.Count);
			if (data.Count == 0)
				return;
			if (AreAllDictionaryValuesTheSameType(data))
				SaveDictionaryWhenAllValuesAreTheSameType(data, writer);
			else
				SaveDictionaryWhenAllValuesAreNotTheSameType(data, writer);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:BinaryDataSaver.cs

示例4: SaveCharArray

		private static void SaveCharArray(object data, BinaryWriter writer)
		{
			writer.WriteNumberMostlyBelow255(((char[])data).Length);
			writer.Write((char[])data);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:5,代码来源:BinaryDataSaver.cs

示例5: SaveMemoryStream

		private static void SaveMemoryStream(object data, BinaryWriter writer)
		{
			var stream = data as MemoryStream;
			writer.WriteNumberMostlyBelow255((int)stream.Length);
			writer.Write(stream.ToArray());
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:6,代码来源:BinaryDataSaver.cs

示例6: WriteAndReadNumberMostlyBelow255WithANumberOver255

		public void WriteAndReadNumberMostlyBelow255WithANumberOver255()
		{
			var data = new MemoryStream();
			var writer = new BinaryWriter(data);
			const int NumberOver255 = 123456;
			writer.WriteNumberMostlyBelow255(NumberOver255);
			data.Position = 0;
			var reader = new BinaryReader(data);
			Assert.AreEqual(NumberOver255, reader.ReadNumberMostlyBelow255());
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:BinaryDataLoadSaveTests.cs

示例7: ToByteArrayWithLengthHeader

 public static byte[] ToByteArrayWithLengthHeader(byte[] messageData, bool dataIsCompressed)
 {
     using (var total = new MemoryStream())
     using (var writer = new BinaryWriter(total))
     {
         writer.WriteNumberMostlyBelow255(messageData.Length);
         writer.Write(dataIsCompressed);
         writer.Write(messageData);
         return total.ToArray();
     }
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:11,代码来源:TcpSocket.cs


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