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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:47:50+00:00 2026-06-01T11:47:50+00:00

There is a virtual method in a library that my C# project references. How

  • 0

There is a virtual method in a library that my C# project references. How can I override this method in another class within my application?

Example:

namespace TheLibary
{
   class SomeClass
   {
      public virtual void TheMethod()
      {
           //Do Stuff
      }
   }
}

Then in my project:

using theLibary;
namespace TheProject
{
   class SomeClass
   {
       public override <Help>
   }
}

Edit: Confusion and totally forgetting that this class didn’t inherit from the libraries class messed me up, it was late 🙂

  • 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-06-01T11:47:51+00:00Added an answer on June 1, 2026 at 11:47 am

    You should study a bit about OOP (and inheritance in particular) before getting down to any serious coding. For quick reference, here’s an example of how to override a method:

    namespace TheDll
    {
        public class SomeClass
        {
            public virtual void TheMethod()
            { }
        }
    }
    
    namespace TheProject
    {
        public class DerivedClass : SomeClass
        {
            public override void TheMethod()
            { }
        }
    }
    

    You should observe that the signature of the overriding method (including its name) must be the same. The derived class, on the other hand, may (and typically should, for clarity) be named differently.

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

Sidebar

Related Questions

I have a base class with a virtual method, and multiple subclasses that override
Is there any program code that can help me to pop up the virtual
i have a question, why there is a partial class and a virtual method
This benchmark appears to show that calling a virtual method directly on object reference
Is there any virtual machine to test Android? How can I debug the program
It says that if there is a virtual function, it is a good practice
Are there tools for migrating from one virtual machine type to another? E.g let's
I'm working on legacy code that looks very similar to this: public class BaseParser
Whenever i override a method of a base class, other than my implementation of
I was reading custom serialization article on msdn: http://msdn.microsoft.com/en-us/library/ty01x675%28VS.80%29.aspx It mentions that there are

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.