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

  • SEARCH
  • Home
  • 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 1088755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:07:03+00:00 2026-05-16T23:07:03+00:00

i ask myself if it is a good design if an extension method uses

  • 0

i ask myself if it is a good design if an extension method uses
another in the same extension class.

public class ClassExtensions
{
   public static bool IsNotNull<T>(this T source)
      where T : class
   {
      return !source.IsNull();
   }

   public static bool IsNull<T>(this T source)
      where T : class
   {
      return source == null;
   }
}

EDIT
Thanks for the answers.
And sorry for the bad sample.

  • 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-16T23:07:04+00:00Added an answer on May 16, 2026 at 11:07 pm

    It’s fine. Your example is a little trivial, of course, but consider other situations where a method could provide overloads (using string.Substring as example… pretend method doesn’t already exist).

    public static class Foo
    {
        public static string Substring(this string input, int startingIndex)
        {
             return Foo.Substring(input, startingIndex, input.Length - startingIndex);
             // or return input.Substring(startingIndex, input.Length - startingIndex);
        }
    
        public static string Substring(this string input, int startingIndex, int length)
        {
             // implementation 
        }
    }
    

    Calling overloads obviously allows you to keep your logic centralized as much as possible without repeating yourself. It is true in instance methods, it is true in static methods (including, by extension, extension methods).

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

Sidebar

Related Questions

I'm no Java guy, so I ask myself what this means: public Button(Light light)
I ask myself how use multiple images in one. For example youtube -> http://s.ytimg.com/yt/img/master-vfl102488.png
looking at dribbble, I have started to ask myself, how I would implement a
I always ask this to myself, and I think it's time to hear some
I tried to ask this question before but I guess I didnt explain myself
I've found myself in a situation, that makes me ask for help. I've got
Since I don't really have a good idea for word to search with myself
One question I ask myself for a long time: below are 2 methods for
Good day, This is more web service design than programming question I think. I'll
I ask myself where reverse engineering is used. I'm interested at learning it. But

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.