mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-27 21:55:54 +08:00
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:
co-authored by
Claude Opus 5.5
parent
b3d09802d0
commit
71ec7b3963
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user