當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。