c# - String.join array from last element -


i have scenario getting comma separated string lastname, firstname. have convert firstname lastname.

my code below:

public static void main(string [] args) {       var str = "lastname, firstname":       var strarr = str.split(',');       array. reverse(strarr);       var output = string.join(" ", strarr); } 

is there better way this, in 1 line or using linq?

yes there reverse extension method ienumerables:

var output = string.join(" ",str.split(',').reverse()); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -