Null pointer test performance
问题 What is the performance of testing whether a reference-type variable in C# is a null-pointer (like if (x == null) ...) compared to testing for an integer being smaller than zero or even a bool being false? Are there other issues know regarding such null-pointer tests , e.g. is garbadge produced ? I do hundred of these tests for every frame of a game and I was wondering if these could cause problems or could be implemented more efficiently? 回答1: Nullity tests are likely to be equivalent to