You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
443 B

1 year ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace JsonRx.Helper
  6. {
  7. public static class Extensions
  8. {
  9. static private List<string> trueSet = new List<string> { "true", "1", "yes", "y" };
  10. public static Boolean ToBoolean(this string str)
  11. {
  12. try
  13. { return trueSet.Contains(str.ToLower()); }
  14. catch { return false; }
  15. }
  16. }
  17. }