C#; implementing an inherited abstract member

Posted on 2004-08-03
Last Modified: 2012-08-14

I am working through Amit Kalani's book in preperation for Microsoft exam 70-315 (Web Apps in C# and .NET), currently nearing the end, the chapter pertaining to testing, debugging and deployment.
The current exercise is about trace listeners, and has you develop a custom class called EmailTraceListener that sends any debug or trace info to an email address. It inherits from the TraceListener class. According to the book, in order to inherit from this class, you must at least implement its Write() and WriteLine() methods, which I have done. Then you also create a Web form pertaining to calculating factorials. In the code for the form, you add a custom listener to the PageLoad() method which uses an EmailTraceListener to add to the custom Listeners collection.
When I attempt to run the Web page, I get an error message in my output window stating that the page does not implement inherited abstract member "System.Diagnostics.TraceListener.Write(string)".
Here is a copy directly from the custom class:
            public override void Write(string message)
                  if (this.message == null)
                        this.message = new    StringBuilder();

Any input out there that might solve this issue?

Thanks in advance,
Robert Waskins
Question by:bob_aloo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 35

Expert Comment

ID: 11717033
Maybe remove the word override?  If there is no base parent definition then there is nothing to override - it just needs to be defined.

Author Comment

ID: 11720201

Thanks for the input. However, the instructions clearly state that the Write() method must be overridden.

If you want a listener object to perform differently from these three
listener classes, you can create your own class that inherits from the
TraceListener class. When doing so, you must at least implement
the Write() and WriteLine() methods.

And the sample code:
// A custom listener must override
// Write() method
public override void Write(string message)
if (this.message == null)
this.message = new StringBuilder();
// A custom listener must override
// WriteLine() method
public override void WriteLine(string message)
if (this.message == null)
this.message = new StringBuilder();
Any other ideas?


Accepted Solution

LlamaJoe earned 125 total points
ID: 11919437
Try deleting your temporary files (c:\windows\\framework\v1.x\temporary files\) for your project, then do a rebuild solution - not build solution.

or - common bizarre issue, make sure you override Write before you override WriteLine

Author Comment

ID: 11936157

You nailed it. I had to override Write before WriteLine.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New Website 15 33
ColdFusion and quickBooks 4 79
Nodejs not returning the response body as expected 4 161
How to setup a password to enter my web page? 3 122
Now that Expression Web 4.0 ( is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question