// ----------------------------------------------------------------------

		//[System.Runtime.CompilerServices.MethodImpl((System.Runtime.CompilerServices.MethodImplOptions)256)] // AggressiveInlining
		static protected void WriteValueToBinaryWriter(
			FileTools.BinaryWriter2 bw, object data, bool CompressIntsAs7Bits, TypeCode typeCode)
		{
#if DEBUG
			if ((int)typeCode < (int)TypeCode.Boolean)
				throw new ArgumentException("data is not a Primitive type");
#endif
			switch (typeCode)
			{
				case TypeCode.Boolean:
					bw.Write((bool)data);
					break;
				case TypeCode.Byte:
					bw.Write((byte)data);
					break;
				case TypeCode.Char:
					bw.Write((char)data);
					break;
				case TypeCode.DateTime:
					bw.Write(((DateTime)data).Ticks);
					break;
				case TypeCode.Decimal:
#if (SILVERLIGHT || PORTABLE) && !WINDOWS_PHONE8
						bw.WriteDecimal((Decimal)data);
#else
					bw.Write((Decimal)data);
#endif
					break;
				case TypeCode.Double:
					bw.Write((double)data);
					break;
				case TypeCode.SByte:
					bw.Write((SByte)data);
					break;
				case TypeCode.Single:
					bw.Write((Single)data);
					break;
				case TypeCode.String:
					bw.Write((string)data);
					break;
				case TypeCode.Int16:
					if (CompressIntsAs7Bits)
						bw.WriteSpecial7BitEncodedShort((Int16)data);
					else
						bw.Write((Int16)data);
					break;
				case TypeCode.Int32:
					if (CompressIntsAs7Bits)
						bw.WriteSpecial7BitEncodedInt((Int32)data);
					else
						bw.Write((Int32)data);
					break;
				case TypeCode.Int64:
					if (CompressIntsAs7Bits)
						bw.WriteSpecial7BitEncodedLong((Int64)data);
					else
						bw.Write((Int64)data);
					break;
				case TypeCode.UInt16:
					if (CompressIntsAs7Bits)
						bw.Write7BitEncodedUShort((UInt16)data);
					else
						bw.Write((UInt16)data);
					break;
				case TypeCode.UInt32:
					if (CompressIntsAs7Bits)
						bw.Write7BitEncodedUInt((UInt32)data);
					else
						bw.Write((UInt32)data);
					break;
				case TypeCode.UInt64:
					if (CompressIntsAs7Bits)
						bw.Write7BitEncodedULong((UInt64)data);
					else
						bw.Write((UInt64)data);
					break;

				default:
#if DEBUG
					throw new Exception();
#else
						break;
#endif
			}
		}