示例#1
0
 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]);
 }
示例#2
0
 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);
 }
示例#3
0
        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));
        }
示例#4
0
 public static string[] Get(this VariableTable vt, int rowIndex)
 {
     return(vt.Rows[rowIndex]);
 }
示例#5
0
 public static VariableTable RemoveRow(this VariableTable vt, int rowIndex)
 {
     vt.Rows.RemoveAt(rowIndex);
     return(vt);
 }
示例#6
0
 public static VariableTable SetColumns(this VariableTable vt, params string[] cList)
 {
     vt.Columns = cList;
     vt.Rows    = null;
     return(vt);
 }