mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
31 lines
613 B
C#
31 lines
613 B
C#
using System;
|
|
|
|
namespace NzbDrone.Common
|
|
{
|
|
public static class TryParseExtension
|
|
{
|
|
public static Nullable<int> ParseInt32(this string source)
|
|
{
|
|
Int32 result = 0;
|
|
|
|
if (Int32.TryParse(source, out result))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public static Nullable<long> ParseInt64(this string source)
|
|
{
|
|
Int64 result = 0;
|
|
|
|
if (Int64.TryParse(source, out result))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |