Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Cannot convert &Method
group to non-function pointer type.
The address of an expression (for example, &Method
) has no type and thus cannot be assigned to a non-function pointer variable.
The &
operator is the address-of operator, used to return the address of its operand.
Example
The following sample generates CS8812:
// CS8812.cs (6,22)
unsafe class C
{
static void Method()
{
void* ptr1 = &Method;
}
}
To correct this error
Explicitly convert the expression to the required type (for example, a void
delegate
):
unsafe class C
{
static void Method()
{
void* ptr1 = (delegate*<void>)&Method;
}
}