J
John A Grandy
I need to transfer the data from one data-structure to another :
data-structure 1 : Dictionary<DateTime,decimal?> dataDictionary = new
Dictionary<DateTime,decimal?> ();
data-structure 2 :
DataTable dataTable = new DataTable();
dataTable.Columns.Add( "Col1", typeof( DateTime ) );
dataTable.Columns.Add( "Col2", typeof( decimal ) );
null values in data-structure 1 should be represented as DBNull.Value in
data-structure 2
Currently, I am transferring the data via iteration :
foreach ( KeyValuePair<DateTime, decimal?> data in seriesData )
{
if ( data.Value.HasValue )
{
dataTable.Rows.Add( new object[] { data.Key, data.Value } );
}
else
{
dataTable.Rows.Add( new object[] { data.Key, DBNull.Value } );
}
Is there a faster technique ?
Thanks.
data-structure 1 : Dictionary<DateTime,decimal?> dataDictionary = new
Dictionary<DateTime,decimal?> ();
data-structure 2 :
DataTable dataTable = new DataTable();
dataTable.Columns.Add( "Col1", typeof( DateTime ) );
dataTable.Columns.Add( "Col2", typeof( decimal ) );
null values in data-structure 1 should be represented as DBNull.Value in
data-structure 2
Currently, I am transferring the data via iteration :
foreach ( KeyValuePair<DateTime, decimal?> data in seriesData )
{
if ( data.Value.HasValue )
{
dataTable.Rows.Add( new object[] { data.Key, data.Value } );
}
else
{
dataTable.Rows.Add( new object[] { data.Key, DBNull.Value } );
}
Is there a faster technique ?
Thanks.