return codes

  • Thread starter Thread starter c# beginner
  • Start date Start date
C

c# beginner

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.
 
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
 
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
 
Back
Top