Consider the following program:
C#public class MyClass
{
public string Method(string a)
{
return a;
}
}
public static class MyExtensions
{
public static int GetLength(this MyClass obj, string a)
{
return obj.Method(a).Length;
}
}
class Program
{
static void Main(string[] args)
{
MyClass c = new MyClass();
Console.WriteLine(c.GetLength("Foo"));
}
}
If I run the refactoring Inline method (or Inline method and delete) on the "GetLength" method, the following invalid code is produced:
C#class Program
{
static void Main(string[] args)
{
MyClass c = new MyClass();
Console.WriteLine(obj.Method("Foo").Length);
}
}
obj is undeclared, and should have been named 'c' in this case.
Hi Peter,
Thank you for letting us know about this issue.
I reproduced it passed this ticket to our R&D for further research. We'll notify you in the context of this thread once we have any news.