How to convert decimal array to string array in C#? -


i need convert decimal array string array . how convert decimal[] string[] ? can use

array.convertall()

method task?

of course can use array.convertall method. need conversation can done easyly lambda expression.

string[] string_array = array.convertall(decimal_array, x => x.tostring()); 

array.convertall converts entire array. converts elements in 1 array type.

let's code it;

decimal[] decimal_array = new decimal[] {1.1m, 1.2m, 1.3m, 1.4m }; string[] string_array = array.convertall(decimal_array, x => x.tostring());  foreach (var item in string_array) {       console.writeline("{0} - {1}", item.gettype(), item); } 

output be;

system.string - 1.1 system.string - 1.2 system.string - 1.3 system.string - 1.4 

here demo.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -