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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:43:57+00:00 2026-05-26T10:43:57+00:00

Possible Duplicate: Why can I only access static members from a static function? While

  • 0

Possible Duplicate:
Why can I only access static members from a static function?

While I was trying to call a normal method from inside a static method I got the error:

An object reference is required for the non-static field, method, or property

So this means I need to create the object of the Class and then call the nonstatic method. If I want to call the method directly then I have to declare that method as Static.

But , in this scenario , the calling method and called method belong to same class. So Why do I need to create an object while calling from a Static Method , while I can call a non-static method from non static method.

Ex:

class Program
    {
        //public void outTestMethod(int x,out int y)
        //{
        //    y = x;
        //}
        static void Main(string[] args)
        {
            int a = 10;
            int b = 100;

            outTestMethod(a,out b); 
        }

        private  void outTestMethod(int x, out int y)
        {
            y = x;
        }
    }

Error:An object reference is required for the non-static field, method, or property

  • 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-26T10:43:58+00:00Added an answer on May 26, 2026 at 10:43 am

    Static methods can call instance methods – but you need to have an instance on which to call them. It doesn’t matter where that instance comes from particularly, so for example:

    int a = 10;
    int b = 100;
    Program program = new Program();
    program.outTestMethod(a,out b);
    

    Instance methods are associated with a particular instance of the type, whereas static methods are associated with the overall type instead – and the same is true for other kinds of members. So to call an instance method, you need to know which instance you’re interested in. For example, it would be meaningless to have:

    string name = Person.Name;
    

    because you need to know which person you’re talking about:

    Person person = FetchPersonFromSomewhere();
    string name = person.Name;
    

    … that makes much more sense.

    Typically instance methods use or modify the state of the instance.

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

Sidebar

Related Questions

Possible Duplicate: How can I pre-set arguments in JavaScript function call? (Partial Function Application)
Possible Duplicate: Can you make an Extension Method Static/Shared? Extension methods are great! Pardon
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: How can I find the method that called the current method? I
Possible Duplicate: before_filter :require_owner I am trying to restrict access to certain actions using
Possible Duplicate: Can I get more than 1000 records from a DirectorySearcher in Asp.Net?
Possible Duplicate: How can I commit only part of a file in git I
Possible Duplicate Why can't I have a non-integral static const member in a class?
Possible Duplicate: SQL Delete: can't specify target table for update in FROM clause I
Possible Duplicate: Access x86 COM from x64 .NET I have a COM object which

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.