File tree Expand file tree Collapse file tree 2 files changed +601
-576
lines changed
csharp/ql/test/library-tests/dataflow/collections Expand file tree Collapse file tree 2 files changed +601
-576
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Collections ;
2
3
using System . Collections . Generic ;
3
4
using System . Linq ;
4
5
@@ -448,4 +449,28 @@ public void CollectionExpressionSpreadElementFlow()
448
449
A [ ] array = [ .. temp ] ;
449
450
Sink ( array [ 0 ] ) ; // flow
450
451
}
452
+
453
+ [ System . Runtime . CompilerServices . CollectionBuilder ( typeof ( IntegerCollectionBuilder ) , "Create" ) ]
454
+ public class IntegerCollection : IEnumerable < int >
455
+ {
456
+ private int [ ] items ;
457
+
458
+ public A ? Payload { get ; set ; }
459
+
460
+ public IntegerCollection ( ReadOnlySpan < int > items )
461
+ {
462
+ this . items = items . ToArray ( ) ;
463
+ Payload = null ;
464
+ }
465
+
466
+ public IEnumerator < int > GetEnumerator ( ) => items . AsEnumerable < int > ( ) . GetEnumerator ( ) ;
467
+
468
+ IEnumerator IEnumerable . GetEnumerator ( ) => items . GetEnumerator ( ) ;
469
+ }
470
+
471
+ public static class IntegerCollectionBuilder
472
+ {
473
+ public static IntegerCollection Create ( ReadOnlySpan < int > elements )
474
+ => new IntegerCollection ( elements ) ;
475
+ }
451
476
}
You can’t perform that action at this time.
0 commit comments