内容 与相比
给出以下两个选项:
<ContentControl>Content</ContentControl>
vs.
<ContentControl Content="Content"/>
- 有性能差异吗?
- 您认为什么更具可读性?
- 结论?
我担心这个问题听起来有些幼稚,但如果我不问我怎么知道,所以我决定开枪。
如果我选择了错误的决定,请评论我;)
Given the following two options:
<ContentControl>Content</ContentControl>
vs.
<ContentControl Content="Content"/>
- Any performance differences?
- What would you say is more readable?
- Conclusion?
I'm affraid this question might sound somehow babyish, but how will I know if I won't ask, so I decided to shoot it.
Comment me if I chose the wrong decision ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就生成的内容而言,两者是相同的。性能将是相同的。
然而,第一个选项让您放置一些不是通过简单文本字符串或标记扩展直接生成的内容,例如:
但是,如果您只输入单个文本字符串,我发现第二个更具可读性。
The two are identical, in terms of what is generated. The performance will be identical.
The first option, however, let's you put something that isn't directly generated via a simple text string or a markup extension, such as:
If, however, you're only putting in a single text string, I find the second more readable.
只是出于个人喜好,我投票支持,
但只是因为我发现它更具可读性。 AFAIK 选择其中之一不会对性能产生影响,但我还没有进行任何测试来证实这一点......
Just as a personal preference, I vote for
but only because I find it more readable. AFAIK there is no performance impact by choosing one or the other, but I haven't done any testing to substantiate that...