-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathFunctionpointer.cs
More file actions
46 lines (39 loc) · 1.01 KB
/
Functionpointer.cs
File metadata and controls
46 lines (39 loc) · 1.01 KB
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
using System;
using System.Runtime.InteropServices;
namespace TestFunctionPointer
{
unsafe class TestThings
{
public static delegate* managed<int>[][] Functions = {
new delegate* managed<int>[]
{
&Function,
},
};
public static int Function() => 100;
public static delegate* unmanaged<int>[][] Functions1 = {
new delegate* unmanaged<int>[]
{
&Function1,
},
};
[UnmanagedCallersOnly]
public static int Function1() => 100;
public static delegate* managed<int, int>[][] Functions2 = {
new delegate* managed<int, int>[]
{
&Function2,
},
};
public static int Function2(int a) {
return a;
}
}
unsafe class Program
{
public static int Main()
{
return TestThings.Functions2[0][0](TestThings.Functions[0][0]());
}
}
}