Click here to Skip to main content
15,921,169 members
Home / Discussions / C#
   

C#

 
AnswerRe: C#.Net in Symbian OS Pin
Giorgi Dalakishvili8-Jan-09 18:40
mentorGiorgi Dalakishvili8-Jan-09 18:40 
QuestionBitmap display problem Pin
Member 19809998-Jan-09 9:40
Member 19809998-Jan-09 9:40 
GeneralRe: Bitmap display problem Pin
Luc Pattyn8-Jan-09 9:55
sitebuilderLuc Pattyn8-Jan-09 9:55 
GeneralRe: Bitmap display problem Pin
Member 19809998-Jan-09 9:58
Member 19809998-Jan-09 9:58 
GeneralRe: Bitmap display problem Pin
User 66588-Jan-09 10:35
User 66588-Jan-09 10:35 
GeneralRe: Bitmap display problem Pin
Member 19809998-Jan-09 10:41
Member 19809998-Jan-09 10:41 
GeneralRe: Bitmap display problem Pin
User 66588-Jan-09 10:46
User 66588-Jan-09 10:46 
GeneralRe: Bitmap display problem Pin
Luc Pattyn8-Jan-09 10:50
sitebuilderLuc Pattyn8-Jan-09 10:50 
QuestionUpdating DataBase with DataTable & TableAdapte problem ? Pin
Mohammad Dayyan8-Jan-09 9:31
Mohammad Dayyan8-Jan-09 9:31 
QuestionExceptions Pin
CodingYoshi8-Jan-09 8:52
CodingYoshi8-Jan-09 8:52 
GeneralRe: Exceptions Pin
Luc Pattyn8-Jan-09 10:02
sitebuilderLuc Pattyn8-Jan-09 10:02 
GeneralRe: Exceptions Pin
CodingYoshi8-Jan-09 10:16
CodingYoshi8-Jan-09 10:16 
GeneralRe: Exceptions Pin
Luc Pattyn8-Jan-09 10:28
sitebuilderLuc Pattyn8-Jan-09 10:28 
GeneralRe: Exceptions Pin
Jason C Bourne8-Jan-09 10:31
Jason C Bourne8-Jan-09 10:31 
GeneralRe: Exceptions Pin
CodingYoshi8-Jan-09 10:57
CodingYoshi8-Jan-09 10:57 
GeneralRe: Exceptions Pin
Colin Angus Mackay8-Jan-09 11:18
Colin Angus Mackay8-Jan-09 11:18 
GeneralRe: Exceptions Pin
Jason C Bourne8-Jan-09 11:21
Jason C Bourne8-Jan-09 11:21 
Exceptions generally match with their namespace and are thrown via their public members (although, a property should never throw an exception). You are not really supposed to make plenty of exceptions for the tons of different possible problems. Exception handling is really about exception handling. A public method in System.IO.File.Read() could for example throw a System.IOException , without more. Internally, you don't have to handle that at many levels, you just leave it going up till the public method that was called. In this public method, you may indeed have a problem because another component lower in the chain had a problem, for example a network problem during the Read operation. Well, yes, then you receive a System.NetworkException for example, you catch it and rethrow a new exception of type System.IOException with the original exception provided as "inner exception". This is the normal way of doing.

So, imagine that you create a new library ComicSoft.ZipUtilities , in the simplest case possible, you can think of one single custom exception for the whole assembly called ComicSoft.ZipUtilities.ZipUtilityException which could be thrown by any public method. And when you have to throw your custom exception because something else crashed, you just give the original exception as parameter when you instantiate it.

This is really the simple and academic case, exception handling and rethrow policies is a huge debat Wink | ;-) Exception handling can be made much more elaborate, and exceptions should ideally be forseen to be technically useful. Forsee codes, categorize exceptions, find ways to help locating the problems etc... But in its simplest form, what you should do is one or more exception for public methods, depending on the different possible feedbacks that you think will need to provide. If you start doing that internally, then it really should be to use the exception type as condition to execute real handling.

Jean-Christophe Grégoire

GeneralRe: Exceptions Pin
Colin Angus Mackay8-Jan-09 10:41
Colin Angus Mackay8-Jan-09 10:41 
AnswerRe: Exceptions Pin
HosamAly8-Jan-09 10:37
HosamAly8-Jan-09 10:37 
AnswerRe: Exceptions Pin
Colin Angus Mackay8-Jan-09 10:37
Colin Angus Mackay8-Jan-09 10:37 
QuestionDefaultValue() attribute problem Pin
xJorDyx8-Jan-09 8:48
xJorDyx8-Jan-09 8:48 
AnswerRe: DefaultValue() attribute problem Pin
DaveyM698-Jan-09 8:58
professionalDaveyM698-Jan-09 8:58 
GeneralRe: DefaultValue() attribute problem Pin
xJorDyx8-Jan-09 9:49
xJorDyx8-Jan-09 9:49 
GeneralRe: DefaultValue() attribute problem Pin
DaveyM698-Jan-09 13:01
professionalDaveyM698-Jan-09 13:01 
AnswerRe: DefaultValue() attribute problem Pin
Wendelius8-Jan-09 10:01
mentorWendelius8-Jan-09 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.