Dear friends,
In my current project I am using the CustomCollections with the help of BindingList<T> generic class to store the database records instead using DataSet objects as offline database identities.
Now I do have a large number of property classes each having a large number of properties in it.
I want to implement the INotifyPropertyChan
The purpose to implement the INotifyPropertyChan
I want to maintain a flag whose value will be false whenever the collection gets changed means any property value of any item in the collection gets changed.
My code is like below:
public class Customer :INotifyPropertyCha
{
private int number;
public int Number
{
get { return number; }
set { number = value;if(value!
}
private string name;
public string Name
{
get { return name; }
set { name = value;if(value != name) OnPropertyChanged("Name"); }
}
public event PropertyChangedEven
private void OnPropertyChanged(
{
if (PropertyChanged != null)
PropertyChanged(
}
}
Now what if my class has 100 properties then....
Is there any way out so I dont need to write the same code like below again and again in each property's set method:
if(value != name) OnPropertyChanged("Name");
I dont want to write the above line for every property.
So is it possible to do this using Reflection and subscribe for the event PropertyChanged for every property in the class in a single code block..
I have seen such a code months ago on any website but can't recall it right now as that time I was not so serious and not knowing I might have to implement this in future:)
Suggest me how to do this and put the code snippet if possible.
THANKS in ADVANCE.
Regards,
Hardeek Thakkar
Thanx , Group Co-Ordinators
You are receiving Individual Emails Change Delivery Settings
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
No comments:
Post a Comment