History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-50369
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Normal Normal
Assignee: Sergey Shkredov
Reporter: Vladimir Reshetnikov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ReSharper

When I extract method from anonymous method in a field initilizer, non-static method is extracted.

Created: 03 Oct 07 08:57   Updated: Monday 16:40
Component/s: Refactorings - Extract Method
Fix Version/s: 4.0
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 532
Fixed in build: 798


 Description  « Hide
using System;

class Program
{
    private Action _action = delegate { Console.WriteLine(); };
}

Select 'Console.WriteLine();' and extract method.

using System;

class Program
{
    private Action _action = delegate { MyMethod(); }; // error CS0236: A field initializer cannot reference the non-static field, method, or property 'Program.MyMethod()'

    private void MyMethod()
    {
        Console.WriteLine();
    }
}


 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.