c# - How To Add In List Array Using Loop I am Getting Error? -
hi getting 1 value in list array not adding rows in it.. how add rows in list array ?
for(int a=0;a<_dt.rows.count;a++) { double pw =convert.todouble(_dt.rows[a]["power"]); int vol =convert.toint32(_dt.rows[a]["voltage"]); double pv = pw * vol; list<double> res = new list<double>(); res.add(pv); }
hopes suggestions..
regards,
you adding result list inside loop, must declare bevor loop:
list<double> res = new list<double>(); for(int a=0;a<_dt.rows.count;a++) { double pw =convert.todouble(_dt.rows[a]["power"]); int vol =convert.toint32(_dt.rows[a]["voltage"]); double pv = pw * vol; res.add(pv); }
Comments
Post a Comment