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


C# IWriteContext.WriteBytes方法代码示例

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


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

示例1: Write

        // #end example

        // #example: Write the StringBuilder
        public void Write(IWriteContext writeContext, object o)
        {
            StringBuilder builder = (StringBuilder) o;
            string str = builder.ToString();
            byte[] bytes = Encoding.UTF8.GetBytes(str);
            writeContext.WriteInt(bytes.Length);
            writeContext.WriteBytes(bytes);
        }
开发者ID:Galigator,项目名称:db4o,代码行数:11,代码来源:StringBuilderHandler.cs

示例2: Write

 public override void Write(IWriteContext context, object obj)
 {
     ushort us = (ushort)obj;
     context.WriteBytes(
         new byte[] { 
             (byte)(us>>8),
             (byte)us,
         });
 }
开发者ID:erdincay,项目名称:db4o,代码行数:9,代码来源:UShortHandler.cs

示例3: Write

 public override void Write(IWriteContext context, object obj)
 {
     var charValue = ((char) obj);
     context.WriteBytes(new[]
     {
         (byte) (charValue & unchecked(0xff)), (byte
             ) (charValue >> 8)
     });
 }
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:CharHandler.cs

示例4: Write

 public override void Write(IWriteContext context, object obj)
 {
     uint ui = (uint)obj;
     context.WriteBytes(
         new byte[] { 
             (byte)(ui>>24),
             (byte)(ui>>16),
             (byte)(ui>>8),
             (byte)ui,
         });
 }
开发者ID:superyfwy,项目名称:db4o,代码行数:11,代码来源:UIntHandler.cs

示例5: Write

 public override void Write(IWriteContext context, object obj)
 {
     ulong ui = (ulong)obj;
     context.WriteBytes(
         new byte[] { 
             (byte)(ui>>56),
             (byte)(ui>>48),
             (byte)(ui>>40),
             (byte)(ui>>32),
             (byte)(ui>>24),
             (byte)(ui>>16),
             (byte)(ui>>8),
             (byte)ui,
         });
 }
开发者ID:erdincay,项目名称:db4o,代码行数:15,代码来源:ULongHandler.cs

示例6: Write

 public override void Write(IWriteContext context, object obj)
 {
     decimal dec = (decimal)obj;
     byte[] bytes = new byte[16];
     int offset = 4;
     int[] ints = Decimal.GetBits(dec);
     for (int i = 0; i < 4; i++)
     {
         bytes[--offset] = (byte)ints[i];
         bytes[--offset] = (byte)(ints[i] >>= 8);
         bytes[--offset] = (byte)(ints[i] >>= 8);
         bytes[--offset] = (byte)(ints[i] >>= 8);
         offset += 8;
     }
     context.WriteBytes(bytes);
 }
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:16,代码来源:DecimalHandler.cs

示例7: Write

 public override void Write(IWriteContext context, object obj)
 {
     int shortValue = ((short) obj);
     context.WriteBytes(new[] {(byte) (shortValue >> 8), (byte) shortValue});
 }
开发者ID:masroore,项目名称:db4o,代码行数:5,代码来源:ShortHandler.cs

示例8: WriteElements

		protected virtual void WriteElements(IWriteContext context, object obj, ArrayInfo
			 info)
		{
			if (HandleAsByteArray(obj))
			{
				context.WriteBytes((byte[])obj);
			}
			else
			{
				// byte[] performance optimisation
				if (HasNullBitmap(info))
				{
					BitMap4 nullItems = NullItemsMap(ArrayReflector(Container(context)), obj);
					WriteNullBitmap(context, nullItems);
					for (int i = 0; i < info.ElementCount(); i++)
					{
						if (!nullItems.IsTrue(i))
						{
							context.WriteObject(_handler, ArrayReflector(Container(context)).Get(obj, i));
						}
					}
				}
				else
				{
					for (int i = 0; i < info.ElementCount(); i++)
					{
						context.WriteObject(_handler, ArrayReflector(Container(context)).Get(obj, i));
					}
				}
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:31,代码来源:ArrayHandler.cs

示例9: Write

 public override void Write(IWriteContext context, object obj)
 {
     var dec = (decimal) obj;
     var bytes = new byte[16];
     var offset = 4;
     var ints = decimal.GetBits(dec);
     for (var i = 0; i < 4; i++)
     {
         bytes[--offset] = (byte) ints[i];
         bytes[--offset] = (byte) (ints[i] >>= 8);
         bytes[--offset] = (byte) (ints[i] >>= 8);
         bytes[--offset] = (byte) (ints[i] >>= 8);
         offset += 8;
     }
     context.WriteBytes(bytes);
 }
开发者ID:masroore,项目名称:db4o,代码行数:16,代码来源:DecimalHandler.cs


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