本文整理汇总了C#中SerializationReader.ReadInt16方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader.ReadInt16方法的具体用法?C# SerializationReader.ReadInt16怎么用?C# SerializationReader.ReadInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationReader
的用法示例。
在下文中一共展示了SerializationReader.ReadInt16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeOrder
public static MarketOrder DeserializeOrder(SerializationReader reader)
{
var deal = new MarketOrder
{
ID = reader.ReadInt32(),
AccountID = reader.ReadInt32(),
Comment = reader.ReadString(),
ExitReason = (PositionExitReason)reader.ReadInt16(),
ExpertComment = reader.ReadString(),
PriceEnter = reader.ReadSingle(),
ResultDepo = reader.ReadSingle(),
ResultPoints = reader.ReadSingle(),
Side = reader.ReadSByte(),
State = (PositionState) reader.ReadInt16(),
Symbol = reader.ReadString(),
TimeEnter = reader.ReadDateTime(),
Trailing = reader.ReadString(),
Volume = reader.ReadInt32(),
VolumeInDepoCurrency = reader.ReadSingle()
};
// nullable values
var flags = reader.ReadOptimizedBitVector32();
if (flags[magicIsValued])
deal.Magic = reader.ReadInt32();
if (flags[pendingOrderIdIsValued])
deal.PendingOrderID = reader.ReadInt32();
if (flags[priceBestIsValued])
deal.PriceBest = reader.ReadSingle();
if (flags[priceExitIsValued])
deal.PriceExit = reader.ReadSingle();
if (flags[priceWorstIsValued])
deal.PriceWorst = reader.ReadSingle();
if (flags[stopLossIsValued])
deal.StopLoss = reader.ReadSingle();
if (flags[swapIsValued])
deal.Swap = reader.ReadSingle();
if (flags[takeProfitIsValued])
deal.TakeProfit = reader.ReadSingle();
if (flags[timeExitIsValued])
deal.TimeExit = reader.ReadDateTime();
return deal;
}
示例2: DeserializeUnit
public static Unit DeserializeUnit(SerializationReader reader)
{
var state = reader.ReadOptimizedBitVector32();
var unitType = state[UnitType];
if (unitType == 0) return Unit.Empty;
if (state[UnitIsDoubleValue]) return new Unit(reader.ReadDouble(), (UnitType) unitType);
if (state[UnitIsZeroValue] == 1) return new Unit(0, (UnitType) unitType);
var integerValue = state[UnitIsOptimizedValue] == 1 ? reader.ReadOptimizedInt32() : reader.ReadInt16();
if (state[UnitIsNegativeValue] == 1) integerValue = -integerValue - 1;
return new Unit(integerValue, (UnitType) unitType);
}
示例3: Deserialize
public void Deserialize(ref SerializationReader mySerializationReader)
{
var typeCode = mySerializationReader.ReadInt16();
Value = new HashSet<IComparable>();
var itemCnt = mySerializationReader.ReadInt32();
for (int i = 0; i < itemCnt; i++)
{
Value.Add((IComparable)mySerializationReader.ReadObject());
}
}
示例4: DeserializeUnit
public static Unit DeserializeUnit(SerializationReader reader)
{
BitVector32 state = reader.ReadOptimizedBitVector32();
int unitType = state[UnitType];
if(unitType == 0)
return System.Web.UI.WebControls.Unit.Empty;
else if(state[UnitIsDoubleValue])
return new Unit(reader.ReadDouble(), (UnitType) unitType);
else if(state[UnitIsZeroValue] == 1)
return new Unit(0, (UnitType) unitType);
else
{
int integerValue = state[UnitIsOptimizedValue] == 1 ? reader.ReadOptimizedInt32() : reader.ReadInt16();
if(state[UnitIsNegativeValue] == 1) integerValue = -integerValue - 1;
return new Unit(integerValue, (UnitType) unitType);
}
}