This is my code. I have a try and finally statement. Within the try block i have a fixed statement which sets a pointer variable.
try
{
fixed (char* chRef = p)
{
//code
}
}
finally
{
chRef = null;
}
Im struggling for a way to set the fixed pointer variable to null no matter how the try exits beause of scope. Please help.
char* chRef;
try
{
fixed (chRef = p)
{
//code
}
}
finally
{
chRef = null;
}
Gives me "Error 12 The type of a local declared in a fixed statement must be a pointer type"