Skip to content

Commit 83a5ef4

Browse files
committed
C#: Examples of lambda expressions with explicit return types.
1 parent 25019db commit 83a5ef4

File tree

1 file changed

+9
-0
lines changed
  • csharp/ql/test/library-tests/csharp10

1 file changed

+9
-0
lines changed

csharp/ql/test/library-tests/csharp10/Lambda.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ public class Lambda
44
{
55
public void M1()
66
{
7+
// Examples need for implicitly typed lambdas.
78
Func<int, string> f1 = (int x) => x.ToString();
89
var f2 = (int x) => x.ToString();
10+
11+
// Examples need for explicit return type for implicitly and explicitly typed lambda.
12+
var f3 = object (bool b) => b ? "1" : 0;
13+
Func<bool, object> f4 = object (bool b) => b ? "1" : 0;
14+
15+
// Examples needed for explicit return type for downcast.
16+
var f5 = int (bool b) => b ? 1 : 0;
17+
var f6 = object (bool b) => b ? 1 : 0;
918
}
1019
}
1120

0 commit comments

Comments
 (0)