Is there a one line way I can find the length of the longest of two C# strings? -
Is there a one line way I can find the length of the longest of two C# strings? -
i have 2 strings input parameters method:
public list<answerrow> makeanswers(string c, string r)
on first line of method have code check status both null , return:
if (c == null && r == null) { homecoming null; }
is there safe (one of 2 might null), 1 line way can find length of longest string?
note homecoming type used later on in method after know length of longest string.
math.max(c==null?0:c.length, r==null?0:r.length)
c#
Comments
Post a Comment