Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

Exception Type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
csharpula csharp - 09 Apr 2008 16:24 GMT
Hello ,
I am defining a new attribute for validation purposes ,in case the
validation of the object which has specific attribute not passing well
which kind of exception should I throw? (kind of Ilegal state,is there
an already defined format for it?)
Thank you!
Ignacio Machin ( .NET/ C# MVP ) - 09 Apr 2008 20:59 GMT
> Hello ,
> I am defining a new attribute for validation purposes ,in case the
[quoted text clipped - 4 lines]
>
> *** Sent via Developersdexhttp://www.developersdex.com***

Depends, you can create your own exception if you want. Take a look at
the exceptions deriving from either Exception or ApplicationException
to see if there is one that fits your case
csharpula csharp - 10 Apr 2008 14:04 GMT
Thanks but the question is if there is any kind of already defined
exception I should use in this case.
Ignacio Machin ( .NET/ C# MVP ) - 10 Apr 2008 18:40 GMT
> Thanks but the question is if there is any kind of already defined
> exception I should use in this case.
>
> *** Sent via Developersdexhttp://www.developersdex.com***

Hum,

Frankly I do not know. it would be nice to have a program that given a
type you get all the derived types and/or what types implement it.

Does anybody knows such a tool?
Marc Gravell - 10 Apr 2008 20:22 GMT
> Does anybody knows such a tool?

Reflector
Chris Crowther MBCS - 10 Apr 2008 14:20 GMT
> I am defining a new attribute for validation purposes ,in case the
> validation of the object which has specific attribute not passing well
> which kind of exception should I throw? (kind of Ilegal state,is there
> an already defined format for it?)

I'd look at ArgumentException.  Though I'm not entirely clear from your
post whether it actually is an argument you're testing; if it's not you
might be better off creating your own derived Exception.

Signature

Chris Crowther MBCS
C# Developer
RHD Research Ltd

Marc Gravell - 10 Apr 2008 14:25 GMT
InvalidOperationException goes some of the way...

Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.