BinaryDecoder: empty arrays as collection expressions

Review feedback on #4849: return [] instead of Array.Empty<T>(); for an
array return type it is the same shared instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roman Ettlinger
2026-10-19 16:54:22 +02:00
co-authored by Claude Opus 5.5
parent b3d09802d0
commit 71ec7b3963
+2 -2
View File
@@ -2435,7 +2435,7 @@ namespace Opc.Ua
// an empty array is immutable: all share one instance. // an empty array is immutable: all share one instance.
if (length == 0) if (length == 0)
{ {
return Array.Empty<T>(); return [];
} }
int capacity = GetInitialArrayCapacity<T>(length); int capacity = GetInitialArrayCapacity<T>(length);
@@ -2534,7 +2534,7 @@ namespace Opc.Ua
{ {
if (length == 0) if (length == 0)
{ {
return Array.Empty<T>(); return [];
} }
// The caller verified the length against the remaining bytes. If // The caller verified the length against the remaining bytes. If