RaleTheBlade
August 5th, 2009, 05:32 PM
I cant believe Ive never covered this before, but sometimes I see functions which take enumerations as arguments such as:
FileStream fStream = new FileStream("myfile.txt", FileMode.OpenOrCreate, FileAccess.Read | FileAccess.Write);
And I was just curious as to how that enumeration is implemented inside a particular function. Does it use a switch - case block? Or if-else if-else block? Im creating a new exception handling framework and was curious as to how I could implement the bitwise OR operator with my own enumerations. Like so:
// ExceptionPolicy is a custom static class which handles exceptions
// Handle will handle the exception in the way specified by the ExceptionMedium enumeration
// ExceptionMedium.EventLog tells the Handle method to write the exception data to the windows event log
// ExceptionMedium.Report opens a report dialog allowing the user to report the exception to our
// internal databases
ExceptionPolicy.Handle(myException, ExceptionMedium.EventLog | ExceptionMedium.Report);
FileStream fStream = new FileStream("myfile.txt", FileMode.OpenOrCreate, FileAccess.Read | FileAccess.Write);
And I was just curious as to how that enumeration is implemented inside a particular function. Does it use a switch - case block? Or if-else if-else block? Im creating a new exception handling framework and was curious as to how I could implement the bitwise OR operator with my own enumerations. Like so:
// ExceptionPolicy is a custom static class which handles exceptions
// Handle will handle the exception in the way specified by the ExceptionMedium enumeration
// ExceptionMedium.EventLog tells the Handle method to write the exception data to the windows event log
// ExceptionMedium.Report opens a report dialog allowing the user to report the exception to our
// internal databases
ExceptionPolicy.Handle(myException, ExceptionMedium.EventLog | ExceptionMedium.Report);