Skip to content

Implement Interface through member adds extra casts #472

Description

@shyamnamboodiripad

Ported from TFS WorkItem: 1105750 and http://roslyn.codeplex.com/workitem/482

SSL reported:

Source:

sealed class X : IComparer{
X x;
}

Quick fix:

public int Compare(object x, object y) {
return ((IComparer)this.x).Compare(x, y);
}

Why do you add the cast, even when there is no explicit implementation?
The cast is highlighted as unnecessary (only when the class is sealed)

Activity

  1. added this to the 1.0-rc2 milestone on Feb 13, 2015
  2. DustinCampbell commented on Feb 13, 2015

    @DustinCampbell
    Member

    I bet we never updated this fix to use the simplifier API.

  3. added a commit that references this issue on Apr 10, 2015
    732e055
  4. added a commit that references this issue on Apr 10, 2015
    3945c7e
  5. shyamnamboodiripad commented on May 15, 2015

    @shyamnamboodiripad
    ContributorAuthor

    @jmarolf could you please verify this?

  6. removed their assignment
    on May 20, 2015
  7. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions