private static string createMessage(ValueType type, string specify, params Type[] classes) { StringBuilder sb = new StringBuilder(); sb.Append("Must give "); if (specify != null) { sb.Append(specify); sb.Append(" "); } for (int i = 0; i < classes.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(classes[i].Name); } sb.Append(" for "); sb.Append(typeof(ValueType).Name); sb.Append("."); sb.Append(type); return(sb.ToString()); }
private Value(object value, ValueType type, Type clazz, bool unindexed) : base() { this.value = value; this.Type = type; this.Class = clazz; this.IsUnindexed = unindexed; }
/// <exception cref="VPackValueTypeException"/> public Value(decimal value, ValueType type) : this(value, type, typeof(decimal)) { if (type != ValueType.INT && type != ValueType .UINT && type != ValueType.SMALLINT) { throw new VPackValueTypeException(ValueType .INT, ValueType.UINT, ValueType. SMALLINT); } }
/// <exception cref="VPackValueTypeException"/> public Value(ValueType type, bool unindexed) : this(null, type, null, unindexed) { if (type != ValueType.ARRAY && type != ValueType .OBJECT && type != ValueType.NULL) { throw new VPackValueTypeException(ValueType .ARRAY, ValueType.OBJECT, ValueType .NULL); } }
public VPackBuilderUnexpectedValueException(ValueType type , string specify, params Type[] classes) : base(createMessage(type, specify, classes)) { }
public Value(ValueType type) : this(type, false) { }
private Value(object value, ValueType type, Type clazz) : this(value, type, clazz, false) { }