Marco
Marco

Reputation: 430

Property name in Bindings case insensitive?

I was debugging a piece of code and to my surprise the following lines both worked correct.

Binding binding = new Binding("Text", myObject, "PropertyName");

Binding binding = new Binding("Text", myObject, "propertyname");

It seems that the property name is case-insensitive, but I cannot find anything about this.

Can anybody tell me if I am missing something, or what could be the rational behind this?

Upvotes: 4

Views: 1068

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156978

I don't know where it is documented, but it is in the source indeed.

It uses a StringComparison.OrdinalIgnoreCase to compare the property name from the binding with the actual object's property:

if( tempPropInfo==null
    &&
    String.Equals (propInfos[i].Name, propertyName, StringComparison.OrdinalIgnoreCase)
  )
  {
  }

Upvotes: 5

Related Questions