diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs index 72da4a9e1..aea6052f0 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/ValueListBuilder.cs @@ -21,7 +21,16 @@ namespace System.Collections.Generic _pos = 0; } - public int Length => _pos; + public int Length + { + get => _pos; + set + { + Debug.Assert(value >= 0); + Debug.Assert(value <= _span.Length); + _pos = value; + } + } public ref T this[int index] { |