public static string ToXML <TValue>(this Dictionary <string, TValue> instance, string bleeding) { string result = string.Empty, s; foreach (KeyValuePair <string, TValue> cell in instance) { s = MyObject.ToString(cell.Value).Trim(); if (s.Length > 0) { result = result + bleeding + "<" + cell.Key + ">" + s + "</" + cell.Key + ">" + "\r\n"; } else { result = result + bleeding + "</" + cell.Key + ">" + "\r\n"; } } return(result); }
public MyException(string code, string message) : base(message) { fCode = MyObject.ToString(code).Trim(); fCode = fCode.Substring(0, Math.Min(fCode.Length, 16)); Data["code"] = fCode; }