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


C# SerializerSession.GetBuffer方法代码示例

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


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

示例1: ReadValue

 public override object ReadValue(Stream stream, SerializerSession session)
 {
     var size = sizeof(UInt16);
     var buffer = session.GetBuffer(size);
     stream.Read(buffer, 0, size);
     return BitConverter.ToUInt16(buffer, 0);
 }
开发者ID:Horusiath,项目名称:Wire,代码行数:7,代码来源:UInt16Serializer.cs

示例2: ReadValue

 public override object ReadValue(Stream stream, SerializerSession session)
 {
     var size = sizeof (long);
     var buffer = session.GetBuffer(size);
     stream.Read(buffer, 0, size);
     var ticks = BitConverter.ToInt64(buffer, 0);
     return new DateTime(ticks);
 }
开发者ID:cpx,项目名称:Wire,代码行数:8,代码来源:DateTimeSerializer.cs

示例3: WriteValue

        public override void WriteValue(Stream stream, object value, SerializerSession session)
        {
            var bytes = session.GetBuffer(Int32Serializer.Size);

            var data = decimal.GetBits((decimal) value);
            Int32Serializer.WriteValueImpl(stream, data[0], bytes);
            Int32Serializer.WriteValueImpl(stream, data[1], bytes);
            Int32Serializer.WriteValueImpl(stream, data[2], bytes);
            Int32Serializer.WriteValueImpl(stream, data[3], bytes);
        }
开发者ID:akkadotnet,项目名称:Wire,代码行数:10,代码来源:DecimalSerializer.cs

示例4: ReadValue

        public override object ReadValue(Stream stream, SerializerSession session)
        {
            var length = (int) Int32Serializer.Instance.ReadValue(stream, session);
            if (length == -1)
                return null;

            var buffer = session.GetBuffer(length);

            stream.Read(buffer, 0, length);
            var res = Encoding.UTF8.GetString(buffer, 0, length);
            return res;
        }
开发者ID:Horusiath,项目名称:Wire,代码行数:12,代码来源:StringSerializer.cs

示例5: ReadValue

 public override object ReadValue(Stream stream, SerializerSession session)
 {
     var buffer = session.GetBuffer(16);
     stream.Read(buffer, 0, 16);
     return new Guid(buffer); //TODO: cap array?
 }
开发者ID:cpx,项目名称:Wire,代码行数:6,代码来源:GuidSerializer.cs


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