locked
Variable<T>.Get(context) or context.GetValue(Variable<T>)? RRS feed

  • Question

  • Hello!

    Is there some rule whether to prefer Variable<T>.Get(context) or context.GetValue(Variable<T>)?

    I would assume the first could be preferred due to conceptual reasons as it denotes object before function however the second is probably better if the variable could be null, but is there some best practice issue in this regard?


    Best regards,

    Henrik Dahl
    • Edited by Henrik Dahl Friday, January 22, 2010 3:34 PM Added "?" at the end of the subject
    Friday, January 22, 2010 3:34 PM

Answers

  • I think it's a style preference. The only functional difference between style choices is what gives you ArgumentNullException versus what gives you NullReferenceException.

    Tim

    Friday, January 22, 2010 5:49 PM

All replies

  • I think it's a style preference. The only functional difference between style choices is what gives you ArgumentNullException versus what gives you NullReferenceException.

    Tim

    Friday, January 22, 2010 5:49 PM
  • OK, I think it's a bit strange with this redundancy.
    Friday, January 22, 2010 8:09 PM