How to Convert DataTable Column values from One Unit to another in C#? -


i have datatable column values filled with. i want convert column values 1 unit another.

datatable columns(name,height,width) 

eg:inch meter, meter centimeter etc.

id  unitname 1   inches 2   millimeters 3   fractions 4   decimal 5   feet 6   centimeters 7   meters  private string convert(string strtoconvert, int from, int to)         {             //some code here             return strtoconvert;         } 

you need keep conversion data in sort of container, example keep matrix of values each row use unit , each column unit (so if x==y value 1 since converting unit same unit multiplying one)

after have matrix code like:

double value_to_convert = double.parse(strtoconvert); return (value_to_convert* mat[from][to]).tostring(); 

Comments