By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,827 Members | 813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,827 IT Pros & Developers. It's quick & easy.

return codes

P: n/a
we are trying to standardize return codes across our .NET
applications (that are soon to be developed.) What is the
best practice for standardizing return codes? I know of
only the following option.

Creating a class library that will contain the return
codes (which will be static strings). Calling the return
codes from this library across different applications.

Please let me know if you have implemented return codes in
a better fashion in your applications. your feedback is
appreciated. Thanks.
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If you want standardization across all classes, you should consider
enums instead of static strings.

I've seen many .NET solutions which contain a project called "Common"
(or something similar), with, among other things, a .cs file just for
listing out all the enums the application uses.

Erik

"c# beginner" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
we are trying to standardize return codes across our .NET
applications (that are soon to be developed.) What is the
best practice for standardizing return codes? I know of
only the following option.

Creating a class library that will contain the return
codes (which will be static strings). Calling the return
codes from this library across different applications.

Please let me know if you have implemented return codes in
a better fashion in your applications. your feedback is
appreciated. Thanks.

Nov 15 '05 #2

P: n/a
Hello

If your return codes indicate errors, it is better to use exceptions than
return an error code.

Otherwise, as another poster already wrote, enums are very good option for
return codes.

Best regards,
Sherif
"c# beginner" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
we are trying to standardize return codes across our .NET
applications (that are soon to be developed.) What is the
best practice for standardizing return codes? I know of
only the following option.

Creating a class library that will contain the return
codes (which will be static strings). Calling the return
codes from this library across different applications.

Please let me know if you have implemented return codes in
a better fashion in your applications. your feedback is
appreciated. Thanks.

Nov 15 '05 #3

P: n/a
It is also possible to embed the enum in a user defined structure and
return the structure, which can contain useful information about the
return state.

http://www.geocities.com/jeff_louie/OOP/oop11.htm

Regards,
Jeff
Please let me know if you have implemented return codes in

a better fashion in your applications.<

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.