You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why WPF choose to use weak typing object to store property value in EffectiveValueEntry.Value which is of type object?
Is the main purpose to use less memory to use an object weak type?
But we can actually use EffectiveValueEntry_Int, EffectiveValueEntry_Float and so on to keep the type of property values and avoid boxing:
abstract class EffectiveValueEntry {
public int PropertyIndex {get;set;}
//...
}
class EffectiveValueEntry_Int : EffectiveValueEntry{
interal int Value {get;set;}
//...
}
class EffectiveValueEntry_Float : EffectiveValueEntry{
interal float Value {get;set;}
//...
}
Or is it just a design error, may be caused by historical reasons?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When reading the code of
DependencyObject
, I found the actual value of every property is saved inDependencyObject._effectiveValues
Why WPF choose to use weak typing
object
to store property value inEffectiveValueEntry.Value
which is of typeobject
?Is the main purpose to use less memory to use an
object
weak type?But we can actually use
EffectiveValueEntry_Int
,EffectiveValueEntry_Float
and so on to keep the type of property values and avoid boxing:Or is it just a design error, may be caused by historical reasons?
Beta Was this translation helpful? Give feedback.
All reactions