public static string Get(this VariableTable vt, int rowIndex, int columnIndex) { string[] tmp = Get(vt, rowIndex); if (columnIndex < 0 || columnIndex >= tmp.Length) { return(null); } return(tmp[columnIndex]); }
public static VariableTable AddRow(this VariableTable vt, params string[] data) { if (vt.Columns == null) { throw new ApplicationException("Please call 'SetColumns' method for VariableTable object first."); } if (data.Length > vt.Columns.Length) { throw new ApplicationException("There are " + vt.Columns.Length + " columns of VariableTable' schema, but " + data.Length + " columns in new row to add, more than VariableTable' schema."); } if (vt.Rows == null) { vt.Rows = new List <string[]>(); } vt.Rows.Add(data); return(vt); }
public static string Get(this VariableTable vt, int rowIndex, string columnName, bool ignoreCase = false) { if (vt.Columns == null) { return(null); } int cIndex = -1; for (int i = 0; i < vt.Columns.Length; i++) { if (string.Compare(columnName, vt.Columns[i], ignoreCase) == 0) { cIndex = i; break; } } if (cIndex == -1) { return(null); } return(Get(vt, rowIndex, cIndex)); }
public static string[] Get(this VariableTable vt, int rowIndex) { return(vt.Rows[rowIndex]); }
public static VariableTable RemoveRow(this VariableTable vt, int rowIndex) { vt.Rows.RemoveAt(rowIndex); return(vt); }
public static VariableTable SetColumns(this VariableTable vt, params string[] cList) { vt.Columns = cList; vt.Rows = null; return(vt); }