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 11using System ;
2+ using System . Collections ;
23using System . Collections . Generic ;
34using System . Linq ;
45
@@ -448,4 +449,28 @@ public void CollectionExpressionSpreadElementFlow()
448449 A [ ] array = [ .. temp ] ;
449450 Sink ( array [ 0 ] ) ; // flow
450451 }
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+ }
451476}
You can’t perform that action at this time.
0 commit comments