void GoToBase(object sender, EventArgs e) { MenuCommand item = (MenuCommand)sender; IMember member = (IMember)item.Tag; IMember baseMember = MemberLookupHelper.FindBaseMember(member); if (baseMember != null) { FindReferencesAndRenameHelper.JumpToDefinition(baseMember); } }
public void OverrideGenericMethodTest() { string program = @"using System; class Program { public static void Main() { D d = new D(); d.T<char, int>('a', 1); d.T<int, char>('a', 2); } public virtual void T<A, B>(A a, B b) { } public virtual void T<X, Y>(Y a, X b) { } } class D : Program { public override void T<X, Y>(X a, Y b) { // overrides T<A,B> - type arguments are identified by position } }"; IAmbience ambience = new Dom.CSharp.CSharpAmbience(); ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; MemberResolveResult mrr; mrr = Resolve <MemberResolveResult>(program, "d.T<int, char>('a', 2)", 5); Assert.AreEqual("Program.T<X, Y>", ambience.Convert((IMethod)mrr.ResolvedMember)); mrr = Resolve <MemberResolveResult>(program, "d.T<char, int>('a', 1)", 6); Assert.AreEqual("D.T<X, Y>", ambience.Convert((IMethod)mrr.ResolvedMember)); IMember baseMember = MemberLookupHelper.FindBaseMember(mrr.ResolvedMember); Assert.IsNotNull(baseMember); Assert.AreEqual("Program.T<A, B>", ambience.Convert((IMethod)baseMember)); }