Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Which is more readable is quite a subjective question, however if you ask me I choose the first option. There's however something that bothers me more. You should never allow a potential exception to propagate in your code (this is returning null, you'll find yourself asking again if x is null, and what if you forget once???). You should handle this null value responsible or throw an ArgumentNullException(). A good approach as I see it could be returning object, since nearly everything in C# inherits from object, as you do in your second choice. You can read more here here.

Which is more readable is quite a subjective question, however if you ask me I choose the first option. There's however something that bothers me more. You should never allow a potential exception to propagate in your code (this is returning null, you'll find yourself asking again if x is null, and what if you forget once???). You should handle this null value responsible or throw an ArgumentNullException(). A good approach as I see it could be returning object, since nearly everything in C# inherits from object, as you do in your second choice. You can read more here.

Which is more readable is quite a subjective question, however if you ask me I choose the first option. There's however something that bothers me more. You should never allow a potential exception to propagate in your code (this is returning null, you'll find yourself asking again if x is null, and what if you forget once???). You should handle this null value responsible or throw an ArgumentNullException(). A good approach as I see it could be returning object, since nearly everything in C# inherits from object, as you do in your second choice. You can read more here.

Source Link

Which is more readable is quite a subjective question, however if you ask me I choose the first option. There's however something that bothers me more. You should never allow a potential exception to propagate in your code (this is returning null, you'll find yourself asking again if x is null, and what if you forget once???). You should handle this null value responsible or throw an ArgumentNullException(). A good approach as I see it could be returning object, since nearly everything in C# inherits from object, as you do in your second choice. You can read more here.

lang-cs

AltStyle によって変換されたページ (->オリジナル) /