카테고리 없음

[WPF] MessageBox 에 List 출력하는 방법

디해가태구디 2023. 4. 13. 11:41

You can join everything into a single string with string.Join:

var message = string.Join(Environment.NewLine, list);
MessageBox.Show(message);

However, if you don't have access to .NET 4, you don't have that overload that takes an IEnumerable<string>. You will have to fallback on the one that takes an array:

var message = string.Join(Environment.NewLine, list.ToArray());
MessageBox.Show(message);
  • Use the ", " instead of the Enviornment.NewLine