[Quantproject-developers] QuantProject/b1_ADT ExtendedDataTable.cs, 1.12, 1.13
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2011-01-16 19:50:31
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2260/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: Added GetArrayOfDoubleFromColumn method Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ExtendedDataTable.cs 7 Apr 2008 20:45:28 -0000 1.12 --- ExtendedDataTable.cs 16 Jan 2011 19:50:23 -0000 1.13 *************** *** 109,112 **** --- 109,137 ---- } /// <summary> + /// Get an array of double corresponding to a column compatible with the double type in a given data table + /// </summary> + public static double[] GetArrayOfDoubleFromColumn(DataTable table, + string columnName) + { + int numRows = table.Rows.Count; + double[] arrayOfDouble = new double[numRows]; + int index = 0; + try + { + for(; index!= numRows; index++) + { + arrayOfDouble[index] = (double) table.Rows[index][columnName]; + } + + } + catch(Exception ex) + { + string s = ex.ToString(); + index = numRows; + } + return arrayOfDouble; + } + + /// <summary> /// Get an array of string corresponding to a column compatible with the string type in a given data table /// </summary> |