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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:28:31+00:00 2026-05-29T06:28:31+00:00

In CLR via CSharp chapter 10 Properties Jeff Richter writes: A property method can

  • 0

In CLR via CSharp chapter 10 “Properties” Jeff Richter writes:

A property method can take a long time to execute; field access always
completes immediately. A common reason to use properties is to
perform thread synchroni- zation, which can stop the thread forever,
and therefore, a property should not be used if thread
synchronization is required. In that situation, a method is preferred.
Also, if your class can be accessed remotely (for example, your class
is derived from System.MarshalByRefObject), calling the property
method will be very slow, and therefore, a method is preferred to a
property. In my opinion, classes derived from MarshalByRefObject
should never use properties.

Is this the case even if the property is defined to just return the private field? Why is a Method preferred in synchronization? and why is a Method preferred in MarshalByRefObject scenario?

To clarify my question:
Jeff seems to be making a blanket statement that Properties are not advisable, and that methods are preferable in those 2 scenarios. as Joe White pointed out, properties can have arbitrary code. But methods can run the same arbitrary code. That’s the part i’m having difficulty with. Is there actually advantage in using methods over properties (given the same code is used) for synchronization or marshaling, or does he merely have a problem with language convention?

  • 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-29T06:28:32+00:00Added an answer on May 29, 2026 at 6:28 am

    I think he’s making the point that, because a property can run any arbitrary code, the calling code shouldn’t assume that it will finish immediately.

    If all the property does is return a field, then its method body will actually be inlined by the JIT compiler and it’ll be just as fast as a field access. So it’s not that properties are somehow slower; it’s that they’re black boxes. If you don’t know how a property is implemented, you can’t make assumptions about it returning quickly.

    (That said, making a slow property would be a clear violation of the .NET Framework Design Guidelines, specifically this one: “Do use a method, rather than a property, [if the] operation is orders of magnitude slower than a field set would be”.)

    As for his suggestion of using methods instead, I can’t make any sense of that. Properties are methods: the property getter is a method (typically named get_PropertyName), and the property setter is a method (set_PropertyName), and code that reads the property is compiled to code that makes a method call to get_PropertyName. There’s nothing special that would make a property any slower than a method.

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

Sidebar

Related Questions

In chapter eight (p189) of CLR Via C#, Jeffrey Richter states that: A Type
In Jeffrey Richter's CLR via C# (the .net 2.0 edtion page, 353) he says
In CLR via C# , Jeffrey Richter gives the following example of delegate chaining
Sorry, if duplicate. I'm reading CLR via C#. Chapter Parameters starts with the explanation
I execute the following code via CLR, is there a reason why the message
I am reading CLR via C# by Jeffery Richter and it says a struct
In his excellent book, CLR Via C#, Jeffrey Richter said that he doesn't like
Does anybody know if it's possible to call method on CLR object via indexer
Extract from CLR via C# on Boxing / Unboxing value types ... On Boxing:
Reading CLR via C# 2.0 (I dont have 3.0 with me at the moment)

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.