If in one class A:
Class A
public List<string> getValues
If i want to invoke the method, should I always check if the return value is null? although I don't think it could be null (should be an empty list). i.e.
Class B
public void GetSomething
foreach (var thing in A.getValues)
//do something....
or
Class B
public void GetSomething
var things = A.getValues;
if (things != null)
foreach (var thing in things)
//then doing something....
The reason for asking this question is that when I wrote unit test, I made the method in class A return null instead of empty list, however I dont know in real life if it happens, since if it could be null then it is always good to check rather than try catch the exception, Which one is more appropriate?