Thursday 15 August 2013

wpf - How does IDataErrorInfo.this[string propertyName] work in C#? -


I have always implemented the interface to think exactly what this line means and how it works.
  string IDataErrorInfo.this [string propertyName] {receive {this return.GetValidationError (propertyName); }}   

How does .this [string propertyName] work, and when / how is this property called?

this [key] is actually an indicator, and some assets and There is a cross between a method, it works like a property because you can tie it, but unlike regular properties, it receives a parameter.

Behind the scenario, it has been implemented as a method - get_Item (key) , and if you want to access it through reflection, For example:

  Typhus (Myclass) .GetProperty ("item"); It is also important to know when implementing   

INotifyPropertyChanged , in that case, "item []" or binding. IndexerName should be used as the property name.

No comments:

Post a Comment