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

java - unable show chart in xls document using jasper reports -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -

javascript - How to change image src on success AJAX -