mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 03:45:41 +00:00
🔨 Call Array.Empty<T>() in Stream.GetHash<T>()
This commit is contained in:
parent
a14de1fa96
commit
3b0c304f54
@ -22,7 +22,7 @@
|
|||||||
/// <returns>Returns a <see cref="Byte"/> array representing the hash of the stream.</returns>
|
/// <returns>Returns a <see cref="Byte"/> array representing the hash of the stream.</returns>
|
||||||
public static byte[] GetHash<T>(this Stream stream) where T : HashAlgorithm
|
public static byte[] GetHash<T>(this Stream stream) where T : HashAlgorithm
|
||||||
{
|
{
|
||||||
MethodInfo create = typeof(T).GetMethod("Create", new Type[] { });
|
MethodInfo create = typeof(T).GetMethod("Create", Array.Empty<Type>());
|
||||||
using T crypt = (T)create?.Invoke(null, null);
|
using T crypt = (T)create?.Invoke(null, null);
|
||||||
return crypt?.ComputeHash(stream);
|
return crypt?.ComputeHash(stream);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user