Tech Off Post

Single Post Permalink

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

    ScanIAm wrote:


    Exactly, and I'm fine with that, now, but it doesn't 'feel' right.  That's my own cross to bear Smiley

    string s = "bob";
    if(s!=null)
       Console.WriteLine(bob.Length);

    just seems safer.



    It may seem to you safer, but if you dig deeper into the innner workings of .Net (reading books, blogs, articles etc)  it won't seem safer anymore it will seem redundant and also less performant.