Пример #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);
 }