Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2007

Tip: Looking for answers? Try searching our database.

Java to C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David McCallum - 11 May 2007 06:23 GMT
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
Nicholas Paldino [.NET/C# MVP] - 11 May 2007 14:16 GMT
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).

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> In Java you have an Action class to can assign to various things, e.g.
>
[quoted text clipped - 9 lines]
>
> David McCallum
Chakravarthy - 11 May 2007 18:57 GMT
Did you try the Delegate mechanism that is available in C#.

Post back for more in detail with the requirement.
Signature

Every thing is perfect, as long as you share!!!

Don''t forget to rate the post

> In Java you have an Action class to can assign to various things, e.g.
>
[quoted text clipped - 9 lines]
>
> David McCallum

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.