LATEST CHATTY HEADER
Subscribe to Shacknews Mercury starting at $1/month!
Chrome Shack Community Guidelines Chatty Search
Scroll down to join the conversation.
New to Shacknews? Signup for a Free Account
Already have an account? Login Now
Subscribe to Shacknews Mercury starting at $1/month!
Chrome Shack Community Guidelines Chatty Search
Scroll down to join the conversation.
I have a question that's bugged me for years and I thought I might get some interesting ideas on how to handle a problem I run into quite a bit. I'm writing this using C# in VS2008 and didn't know if someone here might have a solution to this problem.
I have an object Foo. Foo has a Property named Bar. When Bar changes, it raises the BarChanged Event. How do you handle a situation where you want to update Bar, but want to suppress the resulting BarChanged event from happening? Do you have a second Property named something like BarSuppressEvents or something stupid like that?
Thread Truncated. Click to see all 56 replies.
Give foo a function ChangeBarSecretly() that modifies the field (not property) of bar, assuming Bar is a "dumb" property.
Of course, if it's not a dumb property, then the Bar property and ChangeBarSecretly should both call a private ChangeBarImplementation().
I guess really this is the same as setting a property, only with a function =\
But really, when you run into this situation, you may want to take a step back and look at why you're having to do this, and maybe there's a better way?
The post has been reported. Thank you!
You must be logged in to post.
You must be logged in to post.