Java to C#

  • Thread starter Thread starter David McCallum
  • Start date Start date
D

David McCallum

In Java you have an Action class to can assign to various things, e.g.

button.setAction(myAction);
menuitem.setAction(myAction);

The advantage being if I change a property of myAction, e.g. disabled,
caption, the change is reflected in the button and menuItem.

Is there an equivalent in C#

TIA

David McCallum
 
David,

This is the Command pattern, and there isn't anything like that out of
the box in .NET 2.0. If you are using WPF (.NET 3.0), there is a command
infrastructure built into that, but there are a lot of concepts there which
need to be learned on top of that, as it's not just "straight-up" .NET
(dependency properties, routed events, xaml, etc, etc).
 
Did you try the Delegate mechanism that is available in C#.

Post back for more in detail with the requirement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top