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.
Implicitly typed locals cannot be fixed
Implicitly typed local variables and anonymous types are not supported in the fixed context.
To correct this error
- Either remove the fixed modifier from the variable or else give the variable an explicit type.
Example
The following code generates CS0821:
class A
{
static int x;
public static int Main()
{
unsafe
{
fixed (var p = &x) { }
}
return -1;
}
}