Tech Off Post

Single Post Permalink

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

    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";

    just seems safer.

    Sorry, that's just not making sense; maybe you need to come up with a better example, but I can't see it.  s can never be null here ... even if it was you'd sure as hell WANT an exception to be thrown, because it's exceptional ... you don't want to hide this kind of exception.