aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/Translation/DelegateInfo.cs
blob: 27479a0038986c378178f3d9bbc2db2c95b0715c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Runtime.InteropServices;

namespace ARMeilleure.Translation
{
    class DelegateInfo
    {
#pragma warning disable IDE0052 // Remove unread private member
        private readonly Delegate _dlg; // Ensure that this delegate will not be garbage collected.
#pragma warning restore IDE0052

        public IntPtr FuncPtr { get; }

        public DelegateInfo(Delegate dlg)
        {
            _dlg = dlg;

            FuncPtr = Marshal.GetFunctionPointerForDelegate<Delegate>(dlg);
        }
    }
}