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

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -