/// <summary> /// Return a new DataPersistValue instance from /// </summary> /// <param name="value"></param> /// <returns></returns> public static DataPersistValue FromPersist(string value) { DataPersistValue dpv = new DataPersistValue(); dpv.PersistentValue = value; return(dpv); }
/// <summary> /// Add a new values /// </summary> /// <param name="values"></param> public void AddRange(params object[] values) { foreach (object value in values) { if (value == null) { this._Values.Add(NULL); } else { string name = value.GetType().NsName(); switch (name) { case "System.String": this.Add((String)value); break; case "System.Boolean": this.Add((Boolean)value); break; case "System.Int16": this.Add((Int16)value); break; case "System.Int32": this.Add((Int32)value); break; case "System.Int64": this.Add((Int64)value); break; default: if (value is DataPersistValue) { DataPersistValue dpv = value as DataPersistValue; this.Add(dpv); } else if (value is IDataPersistent) { IDataPersistent idp = value as IDataPersistent; this.Add(idp); } else { this.Add(value.ToString()); } break; } } } }
/// <summary> /// Return a DataPersistValue value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public DataPersistValue GetDataPersist(int index) { return(DataPersistValue.FromPersist(this._Get(index))); }
/// <summary> /// Add a new value /// </summary> /// <param name="value"></param> public void Add(DataPersistValue value) { this.Add((value == null ? null : value.PersistentValue)); }
/// <summary> /// Return a long value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public long?GetInt64N(int index) { return(DataPersistValue.ToInt64(this._Get(index))); }
/// <summary> /// Add a new value /// </summary> /// <param name="value"></param> public void Add(long?value) { this._Values.Add(DataPersistValue.ToPersist(value)); }
/// <summary> /// Return a int value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public int?GetInt32N(int index) { return(DataPersistValue.ToInt32(this._Get(index))); }
/// <summary> /// Return a short value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public short?GetInt16N(int index) { return(DataPersistValue.ToInt16(this._Get(index))); }
/// <summary> /// Add a new value /// </summary> /// <param name="value"></param> public void Add(short value) { this._Values.Add(DataPersistValue.ToPersist(value)); }
/// <summary> /// Return a boolean value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public bool GetBoolean(int index) { return(DataPersistValue.ToBoolean(this._Get(index))); }
/// <summary> /// Return a string value from specified index /// </summary> /// <param name="index"></param> /// <returns></returns> public string GetString(int index) { return(DataPersistValue.ToString(this._Get(index))); }