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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:20:59+00:00 2026-05-11T08:20:59+00:00

I have an interface defined like so: public interface IRipper { IRipperHost Host {

  • 0

I have an interface defined like so:

public interface IRipper {     IRipperHost Host { get; set; }      void Rip(FileStream stream);      event RipperEventHandler OnStart;     event RipperEventHandler OnComplete;     event RipperEventHandler OnProgressChanged;         }  public delegate void RipperEventHandler(object sender, RipperEventArgs e); 

and a base class that implements that interface

public class RipperBase : IRipper {      public void Rip(FileStream stream)     {         throw new System.NotImplementedException();     }     public event RipperEventHandler PostRipEvent;     event RipperEventHandler IRipper.OnComplete     {         add         {             if (PostRipEvent != null)             {                 lock (PostRipEvent)                 {                     PostRipEvent += value;                 }             }             else             {                 PostRipEvent = value;             }         }         remove         {             if (PostRipEvent != null)             {                 lock (PostRipEvent)                 {                     PostRipEvent -= value;                 }             }         }     }     ... and so on } 

My question is how would you inherit from RipperBase and override the BaseClass Rip method. in reality that function should be abstract – but i don’t know how to do that with interfaces.

Also how can i call the base classes event handler from the class derived from RipperBase? I tried this

    RipperEventHandler handler = PreRipEvent;     if (handler != null)     {         handler(this, new RipperEventArgs { Message = 'Started Ripping file to CSV!' });     }      handler = RipProgEvent; 

this but I’m getting the ‘event can only appear on the left hand side of += or -=.’ error

any help would be greatly appreciated! I’m trying to make this as scalable as possible.

  • 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. 2026-05-11T08:21:00+00:00Added an answer on May 11, 2026 at 8:21 am

    I would do it like this:

        public abstract class RipperBase : IRipper     {         public void Rip( Filestream fs )         {              RipCore (fs);              OnCompleted();         }          protected abstract void RipCore(Filestream fs);          public event EventHandler<RipperEventArgs> Completed;          protected void OnCompleted         {            if( Completed != null )            {                // TODO: make this Threadsafe.                Completed (this, new RipperEventArgs( ... ) );            }         } } 

    I’ve declared the class as abstract, since I presume that you cannot instantiate objects from RipperBase ?

    Classes that inherit from RipperBase have to override the RipCore method, and implement the correct functionality. Rip is the method that calls the RipCore method, and it also raises the Completed eventhandler. (Maybe you do not want to do this, i dunno).

    You can also make sure that the Rip method calls the RipCore method on another thread if you want.

    For the events, I create a protected method in the base class that can be used to raise the events. If you want to raise the event in a subclass, you just call this method.

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

Sidebar

Ask A Question

Stats

  • Questions 166k
  • Answers 166k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Set the Margin property of button. then the spaces between… May 12, 2026 at 1:21 pm
  • Editorial Team
    Editorial Team added an answer You have to mark the interface as generic as well:… May 12, 2026 at 1:21 pm
  • Editorial Team
    Editorial Team added an answer I have experienced similar problems (Matlab does not notice it… May 12, 2026 at 1:21 pm

Related Questions

High Level With StructureMap, Can I define a assembly scan rule that for an
I have an interface named IAuthorizationRepository with the following interface: public interface IAuthorizationRepository {
I'm developing an application in Silverlight2 and trying to follow the Model-View-ViewModel pattern. I
I have created a spring bean that contains a list of other beans, like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.