mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 09:37:03 +02:00
29 lines
572 B
C#
29 lines
572 B
C#
using System;
|
|
|
|
namespace Robust.Shared.Utility;
|
|
|
|
/// <summary>
|
|
/// Utility functions for working with <see cref="HashCode"/>.
|
|
/// </summary>
|
|
public static class HashCodeHelpers
|
|
{
|
|
/// <summary>
|
|
/// Add the contents of an array to a <see cref="HashCode"/>.
|
|
/// </summary>
|
|
public static void AddArray<T>(ref this HashCode hc, T[]? array)
|
|
{
|
|
if (array == null)
|
|
{
|
|
hc.Add(0);
|
|
return;
|
|
}
|
|
|
|
hc.Add(array.Length);
|
|
|
|
foreach (var item in array)
|
|
{
|
|
hc.Add(item);
|
|
}
|
|
}
|
|
}
|