1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-02-27 16:42:46 +00:00
Radarr/src/NzbDrone.Common/Extensions/TryParseExtensions.cs

31 lines
610 B
C#
Raw Normal View History

using System;
namespace NzbDrone.Common.Extensions
{
public static class TryParseExtensions
{
2015-10-03 19:19:25 +00:00
public static int? ParseInt32(this string source)
{
int result = 0;
if (int.TryParse(source, out result))
{
return result;
}
return null;
}
2013-12-12 00:41:58 +00:00
public static Nullable<long> ParseInt64(this string source)
{
long result = 0;
2013-12-12 00:41:58 +00:00
if (long.TryParse(source, out result))
2013-12-12 00:41:58 +00:00
{
return result;
}
return null;
}
}
}