c# - Callbacks how to pass bool -


i have project (wcf, xaml, c#), , in project have mediator class (which follows mediator pattern). allows classes register callbacks when actions have been completed (for example data loading database).

the 'register' method mediator looks follows:

public void register(action<object> callback, viewmodelmessages message)     {         internallist.addvalue(message, callback);     } 

then classes register notified @ points, whereby callbacks called. works fine.

the problem when attempt pass variable of type bool when action completed. in particular case, want message passed using mediator pattern when edit happening (user input editing of data). should pass along 'true' or 'false'. so, boolean type think.

the registration on side of class wants receive message so:

mediator.mediator.instance.register(             (object o) =>             {                 // o boolean                 if (o == null)                     return;                  if ((o bool) == true)                     // editing in progress                 else                     // editing on ");             }, mediator.mediator.viewmodelmessages.editcharactermode); 

now tells me, object, 'o' can't bool because bool not nullable.

i feel tackle in ugly way making class bool in or that, since surely comes frequently, know if there graceful or more accepted solution this.

thanks time.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -