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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:06:40+00:00 2026-05-21T05:06:40+00:00

I have added an extension method to the ASP.NET System.Web.UI.Page. Every page in my

  • 0

I have added an extension method to the ASP.NET System.Web.UI.Page.
Every page in my application inherits from this class.

I cannot just access the extension method, however. I must type this.MyMethod(); instead of just being able to use MyMethod(). I thought that methods/attributes of this were inherently in the default scope. What am I not understanding? Or is this a nuance of extension methods?

  • 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-21T05:06:41+00:00Added an answer on May 21, 2026 at 5:06 am

    I thought that methods/attributes of
    this were inherently in the default
    scope.

    They are. But extension methods are not methods of this in the default scope; they are static methods accessible via syntactic sugar provided as a courtesy by the compiler.

    I believe you already know this, but just to clarify: if ExtensionMethod is an extension method of the class whose scope you’re currently in, typing this:

    this.ExtensionMethod();
    

    …is the same as:

    SomeStaticClass.ExtensionMethod(this);
    

    this needs to be passed as a parameter to ExtensionMethod. The first way above, the compiler simply does this for you.

    Naturally, they could have implemented things differently so that the compiler “brings in” extension methods as well as class members into the default scope; they just simply chose not to. Personally, I like that; but I guess it’s a subjective matter. Anyway, if you dislike having to type this, it’s only a small annoyance, right?

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

Sidebar

Related Questions

I have added a category extension to my NSString class. The method basically formats
I am developping a web application by using the ASP .NET MVC 3 framework.
I have extension method public static T DeepClone<T>(this T source) where T : ISerializable
I have the following compiled query added to my ASP.NET MVC 2 project (as
I am having an issue using BinaryFormatter.Serialize. I have this generic extension method to
I have jsut copied one web apllication (web project) developed in asp.net 3.5 with
I followed this tutorial to create a sample Login application using ASP.NET MVC I
I have an extension method as follows: public static class PageExtensions { public static
I have a output string something like this <*>$<@>%<# I need a extension method
I have an asp.net project in three tier architecture. I added a Business Access

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.