.net - Target ="someType"和 Target ="{x:Type someType}"之间的性能差异

标签 .net wpf performance xaml targettype

<分区>

Possible Duplicate:
Difference between TargetType=“controlType” and TargetType=“{x:Type controlType}”
when to use {x:Type …}?

Difference between TargetType="controlType" and TargetType="{x:Type controlType}"我可以看到这些不同的设置类型的方法基本相同。但我想知道是否有任何性能影响,因为我猜 {x:Type} 将实例化一个标记对象。

最佳答案

我建议少创建一个对象将有利于性能。但是,在这种情况下,性能提升可能非常小,您最好还是考虑一下代码的可读性。

我总是使用 {x:Type someType} 因为它清楚地表明这是我正在谈论的类型。

当我稍后更改内容时,我始终可以搜索 {x:Type

关于.net - Target ="someType"和 Target ="{x:Type someType}"之间的性能差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5449481/

相关文章:

c# - 多线程应用程序是否绑定(bind)到单个内核?

c# - 如何获取非public成员的值

.net - Visual Studio DTE2 : how to get text content of the current document

c# - 将 DatePicker 的日期绑定(bind)到 ConverterParameter

c# - 多个 ContextMenuStrip 的 ToolStripMenuItem

c# - 我们可以在代码隐藏中使用 WPF 绑定(bind)中的 Where 子句吗?

java - 对象数组还是带数组的对象?

.net - 实现 INotifyPropertyChanged 的​​模式?

wpf - 有没有办法在 xaml 编辑器中预览动画?

javascript - 您如何进行页面性能测试?