I've got an List and I want to convert it into string. Including all de strings and data that I've been added to my list.
This is my class
public class MyClass
{
public Boolean success { get; set; }
public String msg { get; set; }
}
Then I declare it in that way:
List<MyClass> list = addDataToList("Passwd", "UserID");
So, how can I convert that list to String?
Thanks for any help.
If you want to concatenate all msg in the list then you can use string.Join as:
string str = string.Join(",", list.Select(r=> r.msg));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With