From @AArnott:
using System;
class Program {
static void Main(string[] args) {
object value = args;
// extract from here
IntPtr p;
unsafe
{
object t = value;
p = IntPtr.Zero;
}
// to here
Console.WriteLine(p);
}
}
Open the C# console app in Dev14 and the Program.cs file.
Select lines 7 - 12 and execute the Extract Method command.
Expected
A new method that takes an object as a parameter and returns an IntPtr is created, and an invocation of that method replaces the selected lines that passes in "value" as the parameter and assigns the result to "IntPtr p".
Actual
A method is created that takes no parameters and returns void. Two compile errors are created by the refactoring as a result.