exception classes

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

I have created my own very simple exception classes e.g

using System;

namespace WebApplication90
{
public class AddressException : ApplicationException
{
public AddressException()
{
}
}
}

I now want to make DLLs for each of my exceptions so I can add them to
different projects. But when I make a DLL and reference it and include
the exception in my code I get 'must be derived from System.Exception'
errors (this happens whether I derive my exception class from Exception
or ApplicationException).

Does anybody know what I'm doing wrong?


Cheers,

Mike
 
That should work fine. App code should look like below. Did you reference
the dll?
using System;



using WebApplication90;

namespace WebApplication90 {

class Program {

static void Main(string[] args) {

AddressException e = new AddressException();

}

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top