本文整理汇总了C#中IReadContext类的典型用法代码示例。如果您正苦于以下问题:C# IReadContext类的具体用法?C# IReadContext怎么用?C# IReadContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReadContext类属于命名空间,在下文中一共展示了IReadContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Read
public override object Read(IReadContext context)
{
var b1 = context.ReadByte();
var b2 = context.ReadByte();
var charValue = (char) ((b1 & unchecked(0xff)) | ((b2 & unchecked(0xff)) << 8));
return charValue;
}
开发者ID:masroore,项目名称:db4o,代码行数:7,代码来源:CharHandler.cs
示例2: Read
public override object Read(IReadContext readContext)
{
IInternalReadContext context = (IInternalReadContext)readContext;
int payloadOffset = context.ReadInt();
if (payloadOffset == 0)
{
context.NotifyNullReferenceSkipped();
return null;
}
int savedOffSet = context.Offset();
try
{
ITypeHandler4 typeHandler = ReadTypeHandler(context, payloadOffset);
if (typeHandler == null)
{
return null;
}
if (IsPlainObject(typeHandler))
{
return ReadPlainObject(readContext);
}
SeekSecondaryOffset(context, typeHandler);
return context.ReadAtCurrentSeekPosition(typeHandler);
}
finally
{
context.Seek(savedOffSet);
}
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:29,代码来源:OpenTypeHandler7.cs
示例3: Read
// #end example
// #example: Read the StringBuilder
public object Read(IReadContext readContext)
{
int length = readContext.ReadInt();
byte[] data = new byte[length];
readContext.ReadBytes(data);
return new StringBuilder(Encoding.UTF8.GetString(data));
}
开发者ID:Galigator,项目名称:db4o,代码行数:10,代码来源:StringBuilderHandler.cs
示例4: Read
public object Read(IReadContext context)
{
int classId = context.ReadInt();
long enumValue = context.ReadLong();
return ToEnum(context, classId, enumValue);
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:7,代码来源:EnumTypeHandler.cs
示例5: Eval
public override object Eval(GameState state, IReadContext c)
{
bool l = (bool)lhs.Eval(state, c);
// Lazy evaluation
if (l == true) return true;
return rhs.Eval(state, c);
}
开发者ID:hgabor,项目名称:boardgame,代码行数:8,代码来源:OrExpr.cs
示例6: Read
public virtual object Read(IReadContext context)
{
object read = StringHandler(context).Read(context);
if (null == read)
{
return null;
}
return ConvertString((string)read);
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:9,代码来源:StringBasedValueTypeHandlerBase.cs
示例7: Read
public override object Read(IReadContext context)
{
double value = (double)base.Read(context);
if (double.IsNaN(value))
{
return null;
}
return value;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:9,代码来源:DoubleHandler0.cs
示例8: Read
public override object Read(IReadContext context)
{
long value = (long)base.Read(context);
if (value == long.MaxValue)
{
return null;
}
return value;
}
开发者ID:Galigator,项目名称:db4o,代码行数:9,代码来源:LongHandler0.cs
示例9: Read
public override object Read(IReadContext context)
{
byte[] bytes = new byte[2];
context.ReadBytes(bytes);
return (ushort)(
bytes[1] & 255 |
(bytes[0] & 255) << 8
);
}
开发者ID:erdincay,项目名称:db4o,代码行数:9,代码来源:UShortHandler.cs
示例10: Read
public override object Read(IReadContext context)
{
int i = context.ReadInt();
if (i == int.MaxValue)
{
return null;
}
return i;
}
开发者ID:Galigator,项目名称:db4o,代码行数:9,代码来源:IntHandler0.cs
示例11: Eval
public override object Eval(GameState state, IReadContext c)
{
var ret = new List<object>();
foreach (var item in set)
{
ret.Add(item.Eval(state, c));
}
return ret;
}
开发者ID:hgabor,项目名称:boardgame,代码行数:9,代码来源:SetExpr.cs
示例12: Read
public override object Read(IReadContext context)
{
float value = (float)base.Read(context);
if (float.IsNaN(value))
{
return null;
}
return value;
}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:9,代码来源:FloatHandler0.cs
示例13: Read
public override object Read(IReadContext context)
{
var value = context.ReadLong();
if (value == long.MaxValue)
{
return PrimitiveNull();
}
return new DateTime(value);
}
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:DateHandler0.cs
示例14: Read
public override object Read(IReadContext context)
{
short value = (short)base.Read(context);
if (value == short.MaxValue)
{
return null;
}
return value;
}
开发者ID:erdincay,项目名称:db4o,代码行数:9,代码来源:ShortHandler0.cs
示例15: WriteToReadRepository
/// <summary>
/// Initializes a new instance of the <see cref="WriteToReadRepository"/> class.
/// </summary>
public WriteToReadRepository(IReadContext readContext)
{
if (readContext == null)
{
throw new ArgumentNullException(nameof(readContext));
}
this.readContext = readContext;
}
开发者ID:Jan-Olof,项目名称:CQRS,代码行数:12,代码来源:WriteToReadRepository.cs
示例16: Read
public override object Read(IReadContext context)
{
ByteArrayBuffer buffer = (ByteArrayBuffer)((IInternalReadContext)context).ReadIndirectedBuffer
();
if (buffer == null)
{
return null;
}
return ReadString(context, buffer);
}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:10,代码来源:StringHandler0.cs
示例17: Read
public override object Read(IReadContext context)
{
byte[] bytes = new byte[4];
context.ReadBytes(bytes);
return (uint)(
bytes[3] & 255 |
(bytes[2] & 255) << 8 |
(bytes[1] & 255) << 16 |
(bytes[0] & 255) << 24
);
}
开发者ID:superyfwy,项目名称:db4o,代码行数:11,代码来源:UIntHandler.cs
示例18: Eval
public override object Eval(GameState state, IReadContext c)
{
var f = (ICallable)name.Eval(state, c);
if (f == null) throw new InvalidGameException("Invalid function: " + name);
object[] args = new object[p.Length];
//args[0] = c;
for (int i = 0; i < p.Length; i++)
{
args[i] = p[i].Eval(state, c);
}
return f.Call(state, Context.NewLocal(state), args);
}
开发者ID:hgabor,项目名称:boardgame,代码行数:12,代码来源:FunctionCallExpr.cs
示例19: ReadElements
protected override void ReadElements(IReadContext context, ArrayInfo info, object
array)
{
if (array == null)
{
return;
}
object[] objects = new object[info.ElementCount()];
ReadInto(context, info, objects);
ArrayReflector(Container(context)).Shape(objects, 0, array, ((MultidimensionalArrayInfo
)info).Dimensions(), 0);
}
开发者ID:Galigator,项目名称:db4o,代码行数:12,代码来源:MultidimensionalArrayHandler.cs
示例20: Read
public override object Read(IReadContext context)
{
byte ret = context.ReadByte();
if (ret == True)
{
return true;
}
if (ret == False)
{
return false;
}
return null;
}
开发者ID:superyfwy,项目名称:db4o,代码行数:13,代码来源:BooleanHandler.cs
注:本文中的IReadContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论