Tech Off Post

Single Post Permalink

View Thread: is 'new object().property' or 'new object().method()' a good idea?
  • User profile image
    JChung2006

    evildictaitor wrote:
    
    shuff1203 wrote:
    
    Ya, but he did answer the question, that is a way to do it with just oneline of code in vb.net...


    Well, sort of. The inlined expression in C# does a very different control path to the thing he showed there, which can experience considerable slowdown, since reflection is a relatively expensive process (computationally speaking), and is never a good idea if there's an alternative.

    You missed the point so please just drop it.  Yes, reflection is slower than if the references were already there, but guess what?  Reflection is still faster than a network roundtrip or a disk seek by several orders of magnitude.

    "Premature optimization is the root of all evil." -C. A. R. Hoare