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


C# CompactBinaryReader.ReadInt16方法代码示例

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


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

示例1: ReadDirect

 public override object ReadDirect(CompactBinaryReader reader, object graph)
 {
     Int16[] array = (Int16[])graph;
     for (int i = 0; i < array.Length; i++)
         array[i] = reader.ReadInt16();
     return array;
 }
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:Int16ArraySerializationSurrogate.cs

示例2: Skip

 public override void Skip(CompactBinaryReader reader)
 {
     // Find an appropriate surrogate by handle
     short handle = reader.ReadInt16();
     ISerializationSurrogate typeSurr = TypeSurrogateSelector.GetSurrogateForTypeHandle(handle, reader.Context.CacheContext);
     typeSurr.Skip(reader);
 }
开发者ID:javithalion,项目名称:NCache,代码行数:7,代码来源:EnumSerializationSurrogate.cs

示例3: SkipDirect

 public override void SkipDirect(CompactBinaryReader reader, object graph)
 {
     object[] array = (object[])graph;
     short handle = reader.ReadInt16();
     ISerializationSurrogate surrogate = TypeSurrogateSelector.GetSurrogateForTypeHandle(handle, reader.CacheContext);
     for (int i = 0; i < array.Length; i++)
         reader.SkipObject();
 }
开发者ID:javithalion,项目名称:NCache,代码行数:8,代码来源:ObjectArraySerializationSurrogate.cs

示例4: Read

        public override object Read(CompactBinaryReader reader)
        {
            // Find an appropriate surrogate by handle
            short handle = reader.ReadInt16();
            ISerializationSurrogate typeSurr = TypeSurrogateSelector.GetSurrogateForTypeHandle(handle,reader.Context.CacheContext);

            return Enum.ToObject(ActualType, typeSurr.Read(reader));
        }
开发者ID:javithalion,项目名称:NCache,代码行数:8,代码来源:EnumSerializationSurrogate.cs

示例5: ReadDirect

        public override object ReadDirect(CompactBinaryReader reader, object graph)
        {
            object[] array = (object[])graph;

            short handle = reader.ReadInt16();
            ISerializationSurrogate surrogate = TypeSurrogateSelector.GetSurrogateForTypeHandle(handle, reader.CacheContext);

            Object obj = Array.CreateInstance(surrogate.ActualType, array.Length);

            for (int i = 0; i < array.Length; i++)
                ((Array)obj).SetValue(reader.ReadObject(), i);
            //array[i] = reader.ReadObject();

            return obj;
        }
开发者ID:javithalion,项目名称:NCache,代码行数:15,代码来源:ObjectArraySerializationSurrogate.cs

示例6: SkipDirect

 public override void SkipDirect(CompactBinaryReader reader, object graph)
 {
     String[] array = (String[])graph;
     for (int i = 0; i < array.Length; i++)
     {
         int length = reader.ReadInt16();
         if (length == 0)
         {
             array[i] = null;
             continue;
         }
         length = reader.ReadInt32();
         reader.ReadBytes(length);
     }
 }
开发者ID:christrotter,项目名称:NCache,代码行数:15,代码来源:StringArraySerializationSurrogate.cs

示例7: ReadDirect

        public override object ReadDirect(CompactBinaryReader reader, object graph)
        {
            String[] array = (String[])graph;
            for (int i = 0; i < array.Length; i++)
            {
                if (reader.ReadInt16() == 0)
                    continue;

                int length = reader.ReadInt32();
               
                byte[] stream = new byte[length];
                stream = reader.ReadBytes(length);
                array[i] =  UTF8Encoding.UTF8.GetString(stream);
            }
            return array;
        }
开发者ID:christrotter,项目名称:NCache,代码行数:16,代码来源:StringArraySerializationSurrogate.cs

示例8: Deserialize

		/// <summary>
		/// Deserializes an object from the specified compact binary writer.
		/// </summary>
        /// <param name="reader">Stream containing reader</param>
        /// <param name="cacheContext">Name of the cache</param>
        /// <param name="skip">True to skip the bytes returning null</param>
		static internal object Deserialize(CompactBinaryReader reader,string cacheContext, bool skip)
		{
			// read type handle
			short handle = reader.ReadInt16();
			reader.Context.CacheContext = cacheContext;
			// Find an appropriate surrogate by handle
			ISerializationSurrogate surrogate =
                TypeSurrogateSelector.GetSurrogateForTypeHandle(handle,cacheContext);

			if(surrogate == null)
			{
				throw new CompactSerializationException("Type handle " + handle + "is not registered with Compact Serialization Framework");
			}
            if (!skip)
            {
                return surrogate.Read(reader);
            }
            else
            {
                surrogate.Skip(reader);
                return null;
            }
		}
开发者ID:javithalion,项目名称:NCache,代码行数:29,代码来源:CompactBinaryFormatter.cs

示例9: Read

 public override object Read(CompactBinaryReader reader)
 {
     return reader.ReadInt16();
 }
开发者ID:javithalion,项目名称:NCache,代码行数:4,代码来源:Int16SerializationSurrogate.cs

示例10: Read

		public override object Read(CompactBinaryReader reader)
		{
			int length = reader.ReadInt32();
			Int16[] array = SafeMemoryAllocator.CreateArray<Int16>(length);
			for (int i = 0; i < length; i++) array[i] = reader.ReadInt16();
			return array;
		}
开发者ID:edwardt,项目名称:MySpace-Data-Relay,代码行数:7,代码来源:BuiltinSurrogates.cs


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