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 3333854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:50:30+00:00 2026-05-17T23:50:30+00:00

This is kind of a noob question. I have a simple property bool IsRoot

  • 0

This is kind of a noob question. I have a simple property

bool IsRoot { get { return parent==null; } }

that I call over and over many times from other properties and methods within the class (and derived classes)

I like to keep it like this because it makes the code readable (to me), but I am afraid that all the IsRoot calls are going to slow me down as they might not be “inlined” in the final release code. What I mean by “inlined” is that they are replaced by a copy of the parent==null evaluation in place of get_IsRoot().

Can someone explain to me when (or if) properties are inlined in C#, and for performance oriented applications are properties to be avoided, or not?

EDIT_1:
Short answer is: Properties translate to pure function calls and they might, or might not be inlined depending on what JIT decides. Trust the system to make the right choices and don’t worry about things that might affect things in the 5%-10% level, unless a profiler is used and the end result is fine tuned for performance.

Thanks for the links SO community, and I hope there was a way to award multiple correct answers. Sorry I had to pick one.

  • 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-05-17T23:50:30+00:00Added an answer on May 17, 2026 at 11:50 pm

    Here is an OLD post from Eric Gunnerson that talks about inlining.
    The gist is that the jitter decides whether or a function is to be inlined. My understanding is that you can "encourage" inlining to some degree by writing small functions, but I don’t know how reliable that really is.

    Here is another link from a question here on SO that asks a similar question. Many good links are included.

    Here is an excerpt from one of the links from the second link I posted:

    A short and simple method that is frequently used can be in-lined into the calling code. Currently, the JIT is documented (perhaps "blogged about" would be more precise here) to inline methods that are less than 32 bytes in length, do not contain any complex branching logic, and do not contain any exception handling-related mechanisms. See David Notario’s blog for some additional information on this topic (note that it is not entirely relevant for CLR 2.0).

    I suppose that counts as a rough guideline of when a method might be inlined, but I don’t think that you can say that if a method does meet the criteria above that it will be inlined.

    On a side note, you can force a function to NOT be inlined l ike this:

    [MethodImpl(MethodImplOptions.NoInlining)]
    public void DoNotInlineMe()
    {
      Console.WriteLine("Hello from non-inlined method");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: Hello All, Sorry that this is kind of a noob question. I just
Ok this is kind of embarassing but I just have a rather noob question.
I have this kind of question. In my form, i got this as a
I am sure that this kind of questions must have been asked before, but
I know this question has been kind of asked and have looked into the
Not sure how noob or advanced this question is, but I've been having kind
Kind of a noob question, but I have a page with 42 checkboxes all
this kind of follows on from another question of mine. Basically, once I have
This kind of seems like a noob question, but I could not find an
Sorry if this is kind of a noob question, but I'm just starting to

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.