locked
C# - Intelisense when using "new" keyword RRS feed

  • Question

  • User409654178 posted

    This may be stupid question but why intelisense doesn't suggest method names available when derived class is hiding members with "new" keyword?

    For instance:

    public class BaseNew
    {
    public virtual string DoSomething()
    {
    return "BASE";
    }
    }
    public class DerivedNew : BaseNew
    {
    public new string DoSomething()
    {
    return "DERIVED";
    }
    }

    so as soon as I type "public new" i would expect DoSomething to appear as a suggestion..

    Monday, April 2, 2018 3:07 PM

All replies

  • User-1838255255 posted

    Hi JohnStus,

    According to your description and code, i think you only declare the new method(DoSomething) in the class(DerivedNew), maybe the following Scene is suit for your needs, please check: 

    Best Regards,

    Eric Du 

    Tuesday, April 3, 2018 8:44 AM
  • User409654178 posted

    Hi Eric,

    Cannot access it

    Tuesday, April 3, 2018 1:20 PM