diff --git a/src/ComputeSharp.SourceGenerators/Extensions/HashCodeExtensions.cs b/src/ComputeSharp.SourceGenerators/Extensions/HashCodeExtensions.cs new file mode 100644 index 00000000..1fd0d1cc --- /dev/null +++ b/src/ComputeSharp.SourceGenerators/Extensions/HashCodeExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Immutable; + +namespace ComputeSharp.SourceGenerators.Extensions; + +/// +/// Extension methods for . +/// +internal static class HashCodeExtensions +{ + /// + /// Adds all items from a given instance to an hashcode. + /// + /// The type of items to hash. + /// The target instance. + /// The input items to hash. + public static void AddRange(this ref HashCode hashCode, ImmutableArray items) + { + foreach (T item in items) + { + hashCode.Add(item); + } + } +}