[Quantproject-developers] QuantProject/b1_ADT ExtendedDataTable.cs,1.3,1.4
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2004-08-04 22:50:48
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29597/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: Updated ExtendedDataTable class Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtendedDataTable.cs 25 Jul 2004 12:08:52 -0000 1.3 --- ExtendedDataTable.cs 4 Aug 2004 22:50:40 -0000 1.4 *************** *** 1,4 **** --- 1,6 ---- using System; using System.Data; + using System.Windows.Forms; + namespace QuantProject.ADT *************** *** 57,61 **** --- 59,89 ---- } } + + /// <summary> + /// Get an array of float corresponding to a column compatible with the float type in a given data table + /// </summary> + public static float[] GetArrayOfFloatFromColumn(DataTable table, + string columnName) + { + int numRows = table.Rows.Count; + float[] arrayOfFloat = new float[numRows]; + int index = 0; + try + { + for(; index!= numRows; index++) + { + arrayOfFloat[index] = (float) table.Rows[index][columnName]; + } + } + catch(Exception ex) + { + MessageBox.Show(ex.ToString()); + index = numRows; + } + return arrayOfFloat; + + } + } } |