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

ParseExtensions.cs 489 B

123456789101112131415161718
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // ParseExtensions.cs
  3. namespace DevTeam;
  4. public static class ParseExtensions
  5. {
  6. public static long TryParseLong(this Dictionary<string, string> data, string key)
  7. {
  8. ArgumentNullException.ThrowIfNull(data);
  9. if (data.TryGetValue(key, out string? value) && !string.IsNullOrEmpty(value) && long.TryParse(value, out var result))
  10. {
  11. return result;
  12. }
  13. return default;
  14. }
  15. }