c# - Convert List to single string -


trying convert list property string, ideas?

public class contactlog {      public string { get; set; }      public string message { get; set; }       public string formattedmessage      {          { return to+ ',' + message; }      }  }  public void sendbatch(list<contactlog> logs) {     //problem line     string messages = createbulkmessage(logs.select(o => o.formattedmessage)); } public string createbulkmessage(string message) {     //do stuff } 

you can use string.join combine results of select 1 string:

string messages = string.join(", ", logs.select(o => o.formattedmessage)); 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -