-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNativeGenericDelegateInfo.cs
More file actions
28 lines (27 loc) · 1.1 KB
/
NativeGenericDelegateInfo.cs
File metadata and controls
28 lines (27 loc) · 1.1 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
using System;
using System.Runtime.InteropServices;
namespace NativeGenericDelegates
{
/// <summary>
/// Represents a native generic delegate signature and marshaling behaviors.
/// </summary>
/// <param name="ReturnParameter">The method return parameter type and marshaling behavior.</param>
/// <param name="CallingConvention">The unmanaged function calling convention.</param>
/// <param name="Parameters">The method parameter types and marshaling behaviors.</param>
internal sealed record NativeGenericDelegateInfo
(
ParameterWithMarshalAs? ReturnParameter,
CallingConvention CallingConvention,
ParameterWithMarshalAsCollection Parameters
)
{
/// <summary>
/// Gets the return parameter type.
/// </summary>
/// <remarks>
/// If <see cref="ReturnParameter">ReturnParameter</see> is <see langword="null"/>, this returns <see
/// langword="typeof"/>(<see langword="void"/>).
/// </remarks>
public Type ReturnType => ReturnParameter?.ParameterType ?? typeof(void);
}
}