Archived

This topic is now archived and is closed to further replies.

wah_on_2

My Exception classes

Recommended Posts

Hihi, i am writing utilities classes using C#. The utilities contain my own exceptional classes. Until now, my design about the exceptional classes is that: I have my expceitonal class and inherit from ApplicationException and i will assign a message to it when creating the instance of it for more details to identify what''s the problems are. The message is not hardcode in program, the exceptional classes will call a MessageReader class to get the message from a text file by passing a MessageKey for mapping. In this case, i should collect all the messages in a text file, and i confuse with that. I think i should seperate the different exception''s message in different file. For example, at least i will have Common Message(e.g. Out of range) and Applicaiton Message(e.g. field cannot be empty). And then, when the program create common''s exception, the MessageReader will get ,message from common file. However, if i use this method, i will have many message file and it seem difficult to maintain. So i want to know how to do the exception class in a better way? How the .NET to do it? Is it same with me? Does my method correct?

Share this post


Link to post
Share on other sites