mirror of
https://github.com/Radarr/Radarr
synced 2025-02-27 08:33:21 +00:00
31 lines
No EOL
610 B
C#
31 lines
No EOL
610 B
C#
using System;
|
|
|
|
namespace NzbDrone.Common.Extensions
|
|
{
|
|
public static class TryParseExtensions
|
|
{
|
|
public static int? ParseInt32(this string source)
|
|
{
|
|
int result = 0;
|
|
|
|
if (int.TryParse(source, out result))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public static Nullable<long> ParseInt64(this string source)
|
|
{
|
|
long result = 0;
|
|
|
|
if (long.TryParse(source, out result))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |