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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:47:28+00:00 2026-05-21T07:47:28+00:00

I created the following extension method for a ViewPage: using System.Web.Mvc; namespace G3Site {

  • 0

I created the following extension method for a ViewPage:

using System.Web.Mvc;

namespace G3Site {
    public static class ViewPage_Extensions {
        public static void Test(this ViewPage vp) {
            vp.Writer.Write("this is a test");
        }
    }
}

I then put an import statement on my aspx page

<%@ Import Namespace="G3Site" %>

I can call the Test() method through this just fine:

<% this.Test(); %>

But when I try to call it without reference to this:

<% Test(); %>

I get a compiler error:

CS0103: The name 'Test' does not exist in the current context

Does anyone have any idea why this is happening and is there a way around it?

  • 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-21T07:47:28+00:00Added an answer on May 21, 2026 at 7:47 am

    It is a requirement of the C# compiler that extension methods are called ‘off’ of an expression (such as a variable or reference to an object) per the C# language specification (section 7.6.5.2).

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

Sidebar

Related Questions

I created the following extension method: public static bool HasHostAndUrl(this HttpSessionStateBase session) { return
I am trying to compile the following code: public static void RequireOrPermanentRedirect<T>(this System.Web.UI.Page page,
In C#, extension methods can be created by public static class MyExtensions { public
I have created an extension method called AddGZip which looks like the following: public
I created the following method for retrieving stored settings from the database: public String
I created the following helper in my main directory under /Helpers: HtmlHelpers.cs using System;
I created a simple extension method for the ASP.NET MVC UrlHelper. It takes no
I have the following method: public static TEventInvocatorParameters Until <TEventInvocatorParameters, TEventArgs>(this TEventInvocatorParameters p, Func<TEventArgs,
I create the following class: class Image(object): def __init__(self, extension, data, urls=None, user_data=None): self._extension
I created the following interface: <?php interface Action { public function execute(\requests\Request $request, array

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.