i'm working in visual studio c# , have "string-string" dictionary variable few records, example:
{apartment1},{free} {apartment2},{taken}
etc...
how can write inside messagebox shows like:
apartment1 - free apartment2 - taken
etc...
it important each record inside new line in message box.
you loop though each item in dictionary , build string, so:
dictionary<string, string> dictionary = new dictionary<string, string>(); stringbuilder sb = new stringbuilder(); foreach (var item in dictionary) { sb.appendformat("{0} - {1}{2}", item.key, item.value, environment.newline); } string result = sb.tostring().trimend();//when converting string want trim redundant new line @ end messagebox.show(result);
Comments
Post a Comment