File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 69
69
<Compile Include =" $(MSBuildThisFileDirectory)Extensions\SyntaxNodeExtensions.cs" />
70
70
<Compile Include =" $(MSBuildThisFileDirectory)Extensions\TypeDeclarationSyntaxExtensions.cs" />
71
71
<Compile Include =" $(MSBuildThisFileDirectory)Helpers\Comparer{T,TSelf}.cs" />
72
- <Compile Include =" $(MSBuildThisFileDirectory)Helpers\EquatableArray.cs" />
72
+ <Compile Include =" $(MSBuildThisFileDirectory)Helpers\EquatableArray{T} .cs" />
73
73
<Compile Include =" $(MSBuildThisFileDirectory)Helpers\HashCode.cs" />
74
74
<Compile Include =" $(MSBuildThisFileDirectory)Helpers\ImmutableArrayBuilder{T}.cs" />
75
75
<Compile Include =" $(MSBuildThisFileDirectory)Helpers\ObjectPool{T}.cs" />
Original file line number Diff line number Diff line change 3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
using System ;
6
+ using System . Collections ;
7
+ using System . Collections . Generic ;
6
8
using System . Collections . Immutable ;
7
9
using System . Diagnostics . CodeAnalysis ;
8
10
using System . Linq ;
@@ -32,7 +34,7 @@ public static EquatableArray<T> AsEquatableArray<T>(this ImmutableArray<T> array
32
34
/// An imutable, equatable array. This is equivalent to <see cref="ImmutableArray{T}"/> but with value equality support.
33
35
/// </summary>
34
36
/// <typeparam name="T">The type of values in the array.</typeparam>
35
- internal readonly struct EquatableArray < T > : IEquatable < EquatableArray < T > >
37
+ internal readonly struct EquatableArray < T > : IEquatable < EquatableArray < T > > , IEnumerable < T >
36
38
where T : IEquatable < T >
37
39
{
38
40
/// <summary>
@@ -137,6 +139,27 @@ public T[] ToArray()
137
139
return AsImmutableArray ( ) . ToArray ( ) ;
138
140
}
139
141
142
+ /// <summary>
143
+ /// Gets an <see cref="ImmutableArray{T}.Enumerator"/> value to traverse items in the current array.
144
+ /// </summary>
145
+ /// <returns>An <see cref="ImmutableArray{T}.Enumerator"/> value to traverse items in the current array.</returns>
146
+ public ImmutableArray < T > . Enumerator GetEnumerator ( )
147
+ {
148
+ return AsImmutableArray ( ) . GetEnumerator ( ) ;
149
+ }
150
+
151
+ /// <sinheritdoc/>
152
+ IEnumerator < T > IEnumerable < T > . GetEnumerator ( )
153
+ {
154
+ return ( ( IEnumerable < T > ) AsImmutableArray ( ) ) . GetEnumerator ( ) ;
155
+ }
156
+
157
+ /// <sinheritdoc/>
158
+ IEnumerator IEnumerable . GetEnumerator ( )
159
+ {
160
+ return ( ( IEnumerable ) AsImmutableArray ( ) ) . GetEnumerator ( ) ;
161
+ }
162
+
140
163
/// <summary>
141
164
/// Implicitly converts an <see cref="ImmutableArray{T}"/> to <see cref="EquatableArray{T}"/>.
142
165
/// </summary>
You can’t perform that action at this time.
0 commit comments