forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtMethodsCSharp.cs
More file actions
55 lines (44 loc) · 922 Bytes
/
ExtMethodsCSharp.cs
File metadata and controls
55 lines (44 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// Test C# source file that defines interesting EMs
// Compile with: csc /t:library ...
public struct S
{
}
public class C
{
public void M() { }
}
public class CDerived : C
{
}
public static class ExtMethodsCSharp
{
// EM on a struct
public static decimal M1(this S s, decimal d1, float f1)
{
return d1;
}
// EM on a class
public static decimal M2(this C c, decimal d1, float f1)
{
return -d1;
}
// EM on a struct - return void
public static void M3(this S s, decimal d1, float f1)
{
}
// EM on a class - return void
public static void M4(this C c, decimal d1, float f1)
{
}
// EM on a struct - with params
public static decimal[] M3(this S s, params decimal [] p)
{
return p;
}
// EM on a class - with params
public static C M4(this C c, params decimal [] p)
{
return c;
}
}