mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-16 05:21:05 +00:00
17 lines
482 B
C#
17 lines
482 B
C#
![]() |
namespace Microsoft.AI.DevTeam.Extensions
|
|||
|
{
|
|||
|
public static class ParseExtensions
|
|||
|
{
|
|||
|
public static long TryParseLong(this Dictionary<string, string> data, string key)
|
|||
|
{
|
|||
|
ArgumentNullException.ThrowIfNull(data);
|
|||
|
|
|||
|
if (data.TryGetValue(key, out string? value) && !string.IsNullOrEmpty(value) && long.TryParse(value, out var result))
|
|||
|
{
|
|||
|
return result;
|
|||
|
}
|
|||
|
return default;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|