StringUtils.cs 489 B

1234567891011121314151617181920
  1. using System;
  2. using System.Collections.Generic;
  3. namespace BasePaySdk
  4. {
  5. public class StringUtils
  6. {
  7. public static string tryGetNotNullValue(Dictionary<string, object> dict, string key) {
  8. object value = null;
  9. dict.TryGetValue(key, out value);
  10. if (String.IsNullOrWhiteSpace((string)value))
  11. {
  12. throw new Exception(value + " cannot be empty");
  13. }
  14. return (string)value;
  15. }
  16. }
  17. }