EPiServer 中 page[“propertyName”] 和 page.property[“propertyName”] 之间有何不同?

发布于 2024-09-03 15:59:40 字数 96 浏览 3 评论 0原文

EPiServer 中通过 page["propertyName"] 和 page.Property["propertyName"] 访问属性有什么区别?

谢谢!

What is the difference between accessing a property through page["propertyName"] and page.Property["propertyName"] in EPiServer?

Thanx!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

萧瑟寒风 2024-09-10 15:59:40

page["PropName"] 使用 PageData 类的索引器返回 PropertyData 对象的 Value。

page.Property["PropName"] 将返回整个 PropertyData 对象(例如 PropertyLongString),

因此 page["PropName"] 等于 page.Property["PropName"].Value

page["PropName"] uses the indexer of the PageData class to return the Value of the PropertyData object.

page.Property["PropName"] will return the whole PropertyData object (for example a PropertyLongString)

so page["PropName"] equals page.Property["PropName"].Value

留蓝 2024-09-10 15:59:40

具体不知道。但是...

我总是使用 page["PropName"] 我知道它可以与“从中获取数据”和“动态属性”一起使用,并且当您有一个可写页面时,它也可以用于设置值。

从我从多个合作伙伴和 EPiServer 课程中看到的代码来看,这也是最常见的方式。

您可以在这里查看实现并准确了解:
http://sdk.episerver.com/library/cms5/html/T_EPiServer_Core_PageData。嗯

Don't know exactly. But...

I always use page["PropName"] which I know works with "Fetch data from" and "Dynamic properties" and when you have a writable page it also works for setting a value.

Judging by code I've seen from multiple partners and at EPiServer courses it's the most common way too.

You can look at the implementation here and find out exactly:
http://sdk.episerver.com/library/cms5/html/T_EPiServer_Core_PageData.htm

初见终念 2024-09-10 15:59:40

正如 Bjorn 所说:

CurrentPage["PropertyName"]CurrentPage.Property["PropertyName"].Value 相同。

As Bjorn said:

CurrentPage["PropertyName"] is the same as CurrentPage.Property["PropertyName"].Value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文