Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pbl_dk 150 posts 551 karma points
    Sep 23, 2017 @ 14:54
    pbl_dk
    1

    Difference between content and typedcontent

    Just wondering. Whats the difference between TypedContent and Content? Is there any performance difference?

    https://our.umbraco.org/documentation/reference/querying/umbracohelper/

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Sep 23, 2017 @ 19:31
    Rune Hem Strand
    104

    Hi there

    Umbraco.Content() will return a dynamic DynamicPublishedContent object. Similar to using CurrentPage.

    Umbraco.Typed.Content() will return a strongly typed IPublishedContent, similar to using Model.Content.

    TLDR: You should always use IPublishedContent. It's more performant and offers intellisense in Visual Studio. Especially awesome when used with Modelsbuilder.

    There is a great explanation of why Dynamics should be avoided in the Developers Reference -> Common Pitfalls

    If you want some more info see Strongly typed vs Dynamic Content Acces on 24 days in umbraco, it's a few years old but gives a good overview of the difference. Notice that modelsbuilder ships with Umbraco (since version 7.4) so you don't have to install it.

    This stackoverflow post is also quite good :)

    Hope that helps

    All the best
    Rune

  • john blair 48 posts 219 karma points
    Mar 29, 2019 @ 11:17
    john blair
    0

    Umbraco.Typed.Content() is actually Umbraco.TypedContent()

    Thanks.

  • pbl_dk 150 posts 551 karma points
    Sep 23, 2017 @ 20:01
    pbl_dk
    0

    Hi Rune

    Thanks for clarifying. Sure... I remember the Modelsbuilder, I guess my confusion started when it was added to the core. :-) Now it all makes sense. You know, sometimes a basic function can be annoyingly confusing.

    Thanks :-)

    /Peter

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Sep 23, 2017 @ 20:26
    Rune Hem Strand
    2

    True..

    And sometimes a basic function can be deceptively complex ;)

    You're so very welcome!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies