Skip to content

Commit 62a6b59

Browse files
committed
C#: Add test cases for lambda parameter modifiers.
1 parent 8e39ed0 commit 62a6b59

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
public class LambdaParameterModifiers
5+
{
6+
delegate void MyRef(ref int i1);
7+
delegate void MyOut(out int i2);
8+
delegate void MyIn(in int i3);
9+
delegate void MyRefReadonly(ref readonly int i4);
10+
11+
delegate void MyScopedRef(scoped ref int i5);
12+
13+
public void M()
14+
{
15+
// Explicitly typed lambda parameters with modifiers.
16+
var l1 = (ref int x1) => x1;
17+
var l2 = (out int x2) => x2 = 0;
18+
var l3 = (in int x3) => x3;
19+
var l4 = (ref readonly int x4) => x4;
20+
var l5 = (scoped ref int x5) => x5;
21+
var l6 = (params IEnumerable<int> x6) => x6;
22+
23+
// Implicitly typed lambda parameters with modifiers.
24+
MyRef l7 = (ref i1) => { };
25+
MyOut l8 = (out i2) => i2 = 0;
26+
MyIn l9 = (in i3) => { };
27+
MyRefReadonly l10 = (ref readonly i4) => { };
28+
MyScopedRef l11 = (scoped ref i5) => { };
29+
}
30+
}

0 commit comments

Comments
 (0)