From 198fb9cd1b065616a18455374cd26dcba72ecc99 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Mon, 2 Sep 2024 10:47:22 +0100 Subject: [PATCH] Add dual array concat overload (#7377) --- src/Nethermind/Nethermind.Core/Extensions/Bytes.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Nethermind/Nethermind.Core/Extensions/Bytes.cs b/src/Nethermind/Nethermind.Core/Extensions/Bytes.cs index 219adaaf2dc..4e547fcaee9 100644 --- a/src/Nethermind/Nethermind.Core/Extensions/Bytes.cs +++ b/src/Nethermind/Nethermind.Core/Extensions/Bytes.cs @@ -277,6 +277,14 @@ public static byte[] PadRight(this byte[] bytes, int length) return result; } + public static byte[] Concat(byte[] part1, byte[] part2) + { + byte[] result = new byte[part1.Length + part2.Length]; + part1.CopyTo(result, 0); + part2.CopyTo(result.AsSpan(part1.Length)); + return result; + } + public static byte[] Concat(params byte[][] parts) { int totalLength = 0;