EDIT: Thank you for the answers, so how should it be written to be clear in each line what the condition is, or just leave it as it is for the sake of readability?
I adopted an answer from How do I concatenate two arrays in C#? to return an empty array instead of throwing errors
public static T[] Concat<T>(this T[] x, T[] y)
{
if (x == null && y != null) return y;
if (x != null && y == null) return x;
if (x == null && y == null) return new T[0];
int oldLen = x.Length;
Array.Resize<T>(ref x, x.Length + y.Length);
Array.Copy(y, 0, x, oldLen, y.Length);
return x;
}
Resharper is making the squiggly line, "expression is always true" hint:
What I don't understand is that there should be 4 distinct cases for 2 distinct variables, 2 for each, permutation of 4 : (x is null,x is not null)(y is null,y is not null)
so all together there are 4 cases that I have tried to capture in the if's
changing the order of the lines just moves the squiggly line to the last if line.