public object AsObject() { switch (TypeCode) { case ElaTypeCode.Boolean: return(I4 == 1); case ElaTypeCode.Char: return((Char)I4); case ElaTypeCode.Double: return(Ref.AsDouble()); case ElaTypeCode.Integer: return(I4); case ElaTypeCode.Long: return(Ref.AsLong()); case ElaTypeCode.Single: return(DirectGetSingle()); case ElaTypeCode.String: return(DirectGetString()); case ElaTypeCode.Unit: return(null); case ElaTypeCode.Lazy: return(Ref.Force(this, ElaObject.DummyContext).Ref); default: return(Ref); } }
internal double GetDouble() { return(TypeCode == ElaTypeCode.Double ? Ref.AsDouble() : TypeCode == ElaTypeCode.Single ? DirectGetSingle() : TypeCode == ElaTypeCode.Long ? Ref.AsLong() : (Double)I4); }
public double AsDouble() { if (TypeCode == ElaTypeCode.Double) { return(Ref.AsDouble()); } throw InvalidCast(typeof(Double)); }
internal int GetInt() { if (TypeCode == ElaTypeCode.Long) { return((Int32)Ref.AsLong()); } else if (TypeCode == ElaTypeCode.Double) { return((Int32)Ref.AsDouble()); } else if (TypeCode == ElaTypeCode.Single) { return((Int32)DirectGetSingle()); } return(I4); }
internal long GetLong() { if (TypeCode == ElaTypeCode.Long) { return(Ref.AsLong()); } else if (TypeCode == ElaTypeCode.Double) { return((Int64)Ref.AsDouble()); } else if (TypeCode == ElaTypeCode.Single) { return((Int64)DirectGetSingle()); } return((Int64)I4); }
internal float GetSingle() { if (TypeCode == ElaTypeCode.Integer) { return((Single)I4); } else if (TypeCode == ElaTypeCode.Long) { return((Single)Ref.AsLong()); } else if (TypeCode == ElaTypeCode.Double) { return((Single)Ref.AsDouble()); } return(DirectGetSingle()); }