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
Post a Comment