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

Key: RSRP-50606
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Sergey Shkredov
Reporter: Serge Baltic
Votes: 0
Watchers: 0
Operations

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

Introduce Variable: Merges Occurences of Incompatible Types

Created: 07 Oct 07 05:17   Updated: 05 Feb 08 19:54
Component/s: Refactorings - Introduce Variable
Fix Version/s: Mirabilie Futurum
Security Level: Everybody (All jira users)

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


 Description  « Hide
Before:
public class Test
{
	public static void Do()
	{
		DictionaryEvents<string, string> dict = new DictionaryEvents<string, string>();
		CollectionEvents<string> coll = new CollectionEvents<string>();

		dict.BeforeAddRemove += delegate { throw new InvalidOperationException(string.Format("Whoops!")); };
		coll.BeforeAddRemove += delegate { throw new InvalidOperationException(string.Format("Whoops!")); };
	}
}

After introducing from "delegate ... }; ", "Replace All" mode:

public class Test
{
	public static void Do()
	{
		DictionaryEvents<string, string> dict = new DictionaryEvents<string, string>();
		CollectionEvents<string> coll = new CollectionEvents<string>();

		EventHandler<BeforeAddRemoveEventArgs<KeyValuePair<string, string>>> handler = delegate { throw new InvalidOperationException(string.Format("Whoops!")); };
		dict.BeforeAddRemove += handler;
		coll.BeforeAddRemove += handler;
	}
}

The coll.BeforeAddRemove += handler; line has an error because the delegate types are not compatible (have different event args).

The "replace all" candidates should be filtered more thoroughly.



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