Performance - Properties vs Methods

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Bean

    #1

    Performance - Properties vs Methods

    In C#, is there any difference in the performance of using a property to get
    the value of a member variable versus calling a method to retrieve the
    value?

    Thanks,
    Tom


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Performance - Properties vs Methods

    Tom,

    I don't see why there would be. Underneath it all, properties are
    really methods, just with a particular naming scheme.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "Tom Bean" <tbean@t-a-c.com> wrote in message
    news:Olh%23ocTV DHA.2164@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > In C#, is there any difference in the performance of using a property to[/color]
    get[color=blue]
    > the value of a member variable versus calling a method to retrieve the
    > value?
    >
    > Thanks,
    > Tom
    >
    >[/color]


    Comment

    • Michael Mayer

      #3
      Re: Performance - Properties vs Methods

      "Nicholas Paldino [.NET/C# MVP]" <nicholas.paldi no@exisconsulti ng.com>
      wrote in message news:Opo55hTVDH A.2004@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Tom,
      >
      > I don't see why there would be. Underneath it all, properties[/color]
      are[color=blue]
      > really methods, just with a particular naming scheme.
      >
      > Hope this helps.[/color]

      Hopefully they both get inlined if simple enough...
      -mike


      Comment

      Working...