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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -