using System;
using System.Collections.Generic;
namespace System.Collections.Generic
{
///
/// Represents a collection of useful extenions methods.
///
public static class DictionaryExtensions
{
///
/// Translate a dictionary into a string for display.
///
public static string PrettyPrint(this IDictionary dict)
{
if(dict == null)
return "";
string dictStr = "[";
ICollection keys = dict.Keys;
int i = 0;
foreach(K key in keys)
{
dictStr += key.ToString() + "=" + dict[key].ToString();
if(i++ < keys.Count - 1)
{
dictStr += ", ";
}
}
return dictStr + "]";
}
}
}