Skip to content

Commit 9ae6c4b

Browse files
authored
Small correction on SpanByte (#110)
1 parent fc23593 commit 9ae6c4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nanoFramework.CoreLibrary/System/SpanByte.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Copyright (c) .NET Foundation and Contributors
33
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
44
// See LICENSE file in the project root for full license information.
@@ -112,14 +112,14 @@ public byte this[int index]
112112
/// </exception>
113113
public void CopyTo(SpanByte destination)
114114
{
115-
if (destination.Length < _length - _start)
115+
if (destination.Length < _length)
116116
{
117117
throw new ArgumentException($"Destination too small");
118118
}
119119

120-
for (int i = 0; i < _array.Length; i++)
120+
for (int i = 0; i < _length; i++)
121121
{
122-
destination[i] = _array[i];
122+
destination[i] = _array[_start + i];
123123
}
124124
}
125125

0 commit comments

Comments
 (0)