Skip to content

Commit bb3683e

Browse files
committed
Remove unnecessary ArrayList<T> methods from Release build
1 parent 50d5593 commit bb3683e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Acornima/Helpers/ArrayList.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Acornima.Helpers;
7474
[DebuggerDisplay($"{nameof(Count)} = {{{nameof(Count)}}}, {nameof(Capacity)} = {{{nameof(Capacity)}}}, Version = {{{nameof(_localVersion)}}}")]
7575
[DebuggerTypeProxy(typeof(ArrayList<>.DebugView))]
7676
#endif
77-
internal struct ArrayList<T> : IList<T>
77+
internal partial struct ArrayList<T> : IList<T>
7878
{
7979
private const int MinAllocatedCount = 4;
8080

@@ -115,28 +115,30 @@ internal ArrayList(T[] items)
115115
#endif
116116
}
117117

118-
[Conditional("DEBUG")]
118+
#if !DEBUG
119+
readonly partial void AssertUnchanged();
120+
#else
119121
private readonly void AssertUnchanged()
120122
{
121-
#if DEBUG
122123
if (_localVersion != (_sharedVersion?.Value ?? 0))
123124
{
124125
ThrowInvalidOperationException<T>();
125126
}
126-
#endif
127127
}
128+
#endif
128129

129-
[Conditional("DEBUG")]
130+
#if !DEBUG
131+
partial void OnChanged();
132+
#else
130133
private void OnChanged()
131134
{
132-
#if DEBUG
133135
_sharedVersion ??= new StrongBox<int>();
134136

135137
ref var version = ref _sharedVersion.Value;
136138
version++;
137139
_localVersion = version;
138-
#endif
139140
}
141+
#endif
140142

141143
public int Capacity
142144
{

0 commit comments

Comments
 (0)