protected string TestMethod(int number) { string error = null; Dictionary <string, object> hash; StringBuilder dictContents = new StringBuilder(); try { hash = mongoDBAccess.GetOfferData(number); foreach (string key in hash.Keys) { dictContents.Append($"'{key}' ==> '{hash[key]}'\r\n"); } } catch (Exception xception) { error = xception.Message; } return(error ?? dictContents.ToString()); }