Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 4.0 aka C# 2010 > BOOK: Professional C# 4.0 and .NET 4
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional C# 4.0 and .NET 4
This is the forum to discuss the Wrox book Professional C# 4.0 and .NET 4 by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner; ISBN: 9780470502259
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 4.0 and .NET 4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 3rd, 2010, 03:17 AM
Friend of Wrox
Points: 660, Level: 9
Points: 660, Level: 9 Points: 660, Level: 9 Points: 660, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2005
Location: St. Louis, , .
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Default How is PropertyChangedEventHandler used?

[FONT='Verdana','sans-serif']How is PropertyChangedEventHandler used?[/font]
[FONT='Verdana','sans-serif']Can you tell me what this bit of code in a class' Initalize method does?[/font]
There is a class in the project we are working on that has a private Initialize method. And there is a bit of code in this method that I want to discuss.
But first, let me describe the class. The class is defined as something like this:
public class Skoobie : BaseThingy, ISkoobie

So, that means that the class, “Skoobie” has two parents that it is inheriting from. What are all the implications about this?

Anyway, so the Initalize method is something like this:

private void Initialize()
this.PropertyChanged += (o, e) =>
If (e != null)
// some stuff is done


Now, “PropertyCHanged” is a member of the parent class “BaseThingy” which is defined like this:

publiceventPropertyChangedEventHandler PropertyChanged;
[FONT='Verdana','sans-serif']What is the code [/font]this.PropertyChanged += (o, e) =>... all about? Is it a LINQ thingy?
  #2 (permalink)  
Old April 15th, 2011, 10:45 AM
Wrox Author
Points: 1,163, Level: 13
Points: 1,163, Level: 13 Points: 1,163, Level: 13 Points: 1,163, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2010
Location: Austria
Posts: 175
Thanks: 3
Thanked 53 Times in 53 Posts

(o, e) => { //...
is a Lambda expression

CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
  #3 (permalink)  
Old May 24th, 2011, 01:34 AM
Authorized User
Join Date: Mar 2011
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts

Hi Bill,

Is your BaseThingy class implements INotifyPropertyChanged Interface ?
I think it does..

One more thing
PropertyChanged += (o, e) =>

This is a lambda expression that creates:
a Anonymous-Delegate which takes in two parameter (object, PropertyChangedEventArgs)

[Please correct me if i am wrong]

Last edited by MohamedHassanAli; May 24th, 2011 at 01:41 AM.. Reason: Forgot to explain the L Expression

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 04:16 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.