本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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));
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例9: Read
public override object Read(CompactBinaryReader reader)
{
return reader.ReadInt16();
}
示例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;
}