Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:13:25+00:00 2026-06-13T01:13:25+00:00

After reading Skeet’s article , I went with the general advice to ..consider renaming

  • 0

After reading Skeet’s article, I went with the general advice to “..consider renaming some of the methods to reduce the degree of overloading. This advice goes double when it’s across an inheritance hierarchy..”

BUT I would like to understand the ambiguity a bit more (and see if I can keep the overloads!)

These are just some testing helpers to help stub out parts of tedious tests that might require various flavors of view models to be in some Valid or Invalid state first.

I started out using these helpers on two view model that do not have an inheritance relationship and they worked fine.

Then I decided another would be useful for another oveload for ViewModelWrapper, which is the base class to the other view model types. So the compiler complained it didn’t know which extension to use for a previously working subclass of the VmWrapper.

So that’s the 3rd overload and the 1st in the code below in this case. Like I implied, I already just did away with the overloads, but

Does anyone see how I might keep these working as overloads?

Cheers,
Berryl

// SatVm
public static void MakeValid<TParentModel, TModel>(this ISatelliteVm<TParentModel, TModel> instance, IEntityValidator validator) {...}

// HubVm
public static void MakeValid<TParentModel>(this HubViewModel<TParentModel> instance, IEntityValidator validator, bool bValid = true)
where TParentModel : Entity {   ... }

// VmWrapper    
public static void MakeValid<TModel>(this ViewModelWrapper<TModel> instance, IEntityValidator validator) { ... }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:13:26+00:00Added an answer on June 13, 2026 at 1:13 am

    You could simply use a separate namespace for each set of extensions by type of vm.

    namespace Extensions.Satellite
    {
        // SatVm
        public static void MakeValid<TParentModel, TModel>(this ISatelliteVm<TParentModel, TModel> instance, IEntityValidator validator) {...}
    }
    
    namespace Extensions.Hub
    {
        // HubVm
        public static void MakeValid<TParentModel>(this HubViewModel<TParentModel> instance, IEntityValidator validator, bool bValid = true)
            where TParentModel : Entity {   ... }
    }
    
    namespace Extensions.Wrapper
    {
        // VmWrapper    
        public static void MakeValid<TModel>(this ViewModelWrapper<TModel> instance, IEntityValidator validator) { ... }
    }
    

    Then just use the correct namespace.

    In related news, you may want to check this out: Overriding Extension Methods

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading this question, I need to clear up some things. IQueryable<Customer> custs =
After reading the Service Oriented Architecture Principles site and the respective Wikipedia article I
After reading this article, it makes sense to rebase to gather changes from the
After reading the famous (and only) article about trying to explain why asmxs should
After reading some reports about the inadequacies of the Mono 2.6 garbage collector, I
After becoming more engaged with training new engineers as well as reading Jon Skeet's
After reading some statistics about my app I saw that it takes over one
After reading some posts like this one: Choose File Dialog It appears that Android
After reading this SE Discussion a question pops up. Why jquery defined two methods
after reading the Zend documentation and some posts here I could not figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.