Here is the actual scenario: I am attempting to simulate a WinForms MessagBox dialog where a static ShowDialog() call will pop up the dialog box and on final decision will return an enum similar to the DialogResult.
What I have done is declare an enum prior to instantiating an actual instance of the dialog form. The constructor for that dialog form thus receives that enum by reference, so that it can modify the original enum "located" in the static method. I have found that I am not able to stored that reference into a class- local variable and then modify that local variable. I cannot directly manipulate that passed in reference enum since the activity to actually modify the value lies in other methods.
This is so certainly the wrong way, and for now I am not able (must be the heavy lunch) to think of how to effectively store a local enum not as a value type, but as a reference of the original enum outside.
public static PopDialog(){ CustomEnum myEnum = CustomEnum.Default; CustomDialog myCustom = new CustomDialog();
myCustom.ShowDialog(ref myEnum); // this is the regular Windows Form ShowDialog() method.
return myEnum; }
Suggestions appreciated.
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral
Forget this odd ball of an idea.
I have decided to use back the long forgotten route of delegates for callback convenience. Works like a charm.