exception - What's a good way for a c# dll to return error to the calling application? -


I am writing a DLL which is a cover for the access database and I am normally normal in C # because My background is with Pearl in the web development lamps, I'm not sure if there is any good way to return the error to a calling app, if they pass wrong functions to my function or not.

I do not know anything yet, except for some exceptions, I do not know where to start from. Any help or resource will be more than useful :)

thanks ~

Probably the message dialog is not to be displayed in your DLL, which is a client application job, as part of the presentation layer

NET Library Assemblies usually bubbles exceptions to the host application, so this is the same view I see. Public static class library class {public static zero doSomething (int positiveInteger) {if (positiveInteger & lt; 0) {new argument expression ("expected a positive number", "positive integer"); }}}

Then depend on your host application to handle those exceptions, logging them and displaying them in proper form.

  try {LibraryClass.DoSomething (- 3); } Hold (ArgumentException argExc) {MessageBox.Show ("An error occurred:" + argExc.ToString ()); }  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -