mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-16 05:21:05 +00:00
18 lines
455 B
C#
18 lines
455 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
namespace DevTeam;
|
|
|
|
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;
|
|
}
|
|
}
|