I am learning WPF and it seems like some properties like Content are of type Object. When you have a very complex UI with 1000s of controls, would this be a problem with boxing, etc?
I see that this provides a lot of power (having Content to take anything), but just thought I should ask people’s opinions about this.
There really shouldn’t be any performance implications due to boxing, since typically, the Content used within a control is another Control, which is going to be a reference type anyways.
Making
Contentan object, however, allows you to use DataTemplates and provides a huge amount of the flexibility of WPF.That being said, the overhead of boxing, even when you do use a value type as “Content”, is going to be incredibly minimal when compared to the overhead involved in UI code in general.