Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:30:51+00:00 2026-06-11T22:30:51+00:00

In many Umbraco examples i see two different approaches for the same types of

  • 0

In many Umbraco examples i see two different approaches for the same types of work. Sometimes people select, query and return INode. Other people do everything with Node.

Can anyone tell me which is the preferred way of working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:30:52+00:00Added an answer on June 11, 2026 at 10:30 pm

    I’m not familiar with Umbraco, but I don’t think that the answer has to be specific to it.

    If you return INode, it gives you flexibility in the future in that you can return (internally) any class that extends from INode. if INode contains all properties and methods of Node, then no functionality is lost from doing this.

    Take for example, the opportunity of using IEnumerable vs List

    IEnumerable<int> x = MyClass.MyMethod();
    

    Both the following definitions of MyMethod would be valid in this class example.

    public static IEnumerable<int> MyMethod()
    {
        return new List<int>() { 1, 2, 3 };
    }
    
    ....
    
    public static IEnumerable<int> MyMethod()
    {
        return new int[] {1, 2, 3};
    }
    

    This lets you change the implementation of MyMethod without having to modify each caller.

    For your methods, you should return the simplest type that gives all the functionality relavant to its context. Say if you need to modify the list that MyMethod returns, then returning IEnumerable is a bad choice (as it’s immutable).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Many people say to me that set VARCHAR(100) doesnt make sense. It the same
many Places in the sample code i have seen 2 different way of @synthesize
Many people use this method to add animation on switching views. When I try
Many of my classes require access to a database to do their work. For
Many different representation of parameters in python such as : urllib2.urlopen(url[, data][, timeout]) urllib2.build_opener([handler,
Many people say that you just have to add the :username attribute in the
Many simple MEF examples (listed below) uses AttributedAssemblyPartCatalog . Hosting MEF in an application
Many banking websites have you select your own security image when creating your account.
many people use extensively arrays in Excel/VBA to store a list of data. However,
Many times, I'm writing a function which will return true on success and false

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.