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 7439023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:38:39+00:00 2026-05-29T10:38:39+00:00

Say I have an overloaded extension method with the following two signatures: public static

  • 0

Say I have an overloaded extension method with the following two signatures:

public static void MyExtensionMethod(this Foo foo);
public static void MyExtensionMethod(this Foo foo, Bar bar);

I’d like to chain one method to the other. I can do this in one of two ways:

Chaining Technique #1

public static void MyExtensionMethod(this Foo foo)
{
    // Call overload using extension method syntax.
    foo.MyExtensionMethod(new Bar());
}

public static void MyExtensionMethod(this Foo foo, Bar bar)
{
    // Do stuff...
}

Chaining Technique #2

public static void MyExtensionMethod(this Foo foo)
{
    // Call overload as a regular method.
    MyExtensionMethod(foo, new Bar());
}

public static void MyExtensionMethod(this Foo foo, Bar bar)
{
    // Do stuff...
}

This is my question: Is there any difference between calling the overloaded method as an extension method versus as a regular method? If so, what’s the difference? Is one preferable to the other?

  • 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-05-29T10:38:40+00:00Added an answer on May 29, 2026 at 10:38 am

    The second one is actually more stable. The first one will be changed if I do something like:

    public class Foo
    {
        public void MyExtensionMethod(Bar bar)
        {
            Console.WriteLine("instance method");
        }
    }
    

    If I add this then in the first case it calls the instance method, and in the second case it calls the extension method.

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

Sidebar

Related Questions

I noticed this the other day, say you have two overloaded methods: public void
Let's say I have the following method: public static int CountNonNullMembers<T>(this IEnumerable<T> enumerable) {
Say I have two overloaded versions of a C# method: void Method( TypeA a
Let say I have a class like this: public sealed class Foo { public
I have the following functions: public static V AddIfNotPresent<K, V>( this Dictionary<K, V> store,
Lets say have this immutable record type: public class Record { public Record(int x,
Let's say I have two objects, Master and Slave . Slave has a method
This is for Delphi Prism. Say, I have the following enum SET type that
Say i have a few fields like the following: abd738927 jaksm234234 hfk342 ndma0834 jon99322
Say I have 2 scripts test1.sh #!/bin/sh . ./test2.sh foo test2.sh #!/bin/sh foo(){ echo

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.