Changed ThrowLastErrorIfInvalid to a generic method to return the same type as the delegate

pull/211/head
dahall 2020-12-20 08:27:17 -07:00
parent a10fc8fff0
commit 6f0255aa56
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ namespace Vanara.PInvoke
/// <summary>Throws the last error if the value is an invalid handle.</summary>
/// <param name="value">The SafeHandle to check.</param>
/// <param name="message">The message.</param>
public static SafeHandle ThrowLastErrorIfInvalid(SafeHandle value, string message = null) => CheckPredicateOrThrow(value, v => v.IsInvalid, message);
public static T ThrowLastErrorIfInvalid<T>(T value, string message = null) where T : SafeHandle => CheckPredicateOrThrow(value, v => v.IsInvalid, message);
/// <summary>Throws the last error if the value is a NULL pointer (IntPtr.Zero).</summary>
/// <param name="value">The pointer to check.</param>