<PackageReference Include="SSH.NET" Version="2024.2.0" />

TimeSpanExtensions

static class TimeSpanExtensions
Provides extension methods for TimeSpan.
using System; using System.Runtime.CompilerServices; namespace Renci.SshNet.Common { [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(0)] internal static class TimeSpanExtensions { public static int AsTimeout(this TimeSpan timeSpan, [System.Runtime.CompilerServices.CallerArgumentExpression("timeSpan")] string paramName = null) { double totalMilliseconds = timeSpan.TotalMilliseconds; if ((!(totalMilliseconds < -1) && !(totalMilliseconds > 2147483647)) || 1 == 0) return (int)totalMilliseconds; throw new ArgumentOutOfRangeException(paramName, "The timeout must represent a value between -1 and Int32.MaxValue milliseconds, inclusive."); } public static void EnsureValidTimeout(this TimeSpan timeSpan, [System.Runtime.CompilerServices.CallerArgumentExpression("timeSpan")] string paramName = null) { timeSpan.AsTimeout(paramName); } } }