CommandLine.Text.HelpText.GetMaxLength C# (CSharp) Method

GetMaxLength() private static method

private static GetMaxLength ( IList optionList ) : int
optionList IList
return int
        private static int GetMaxLength(IList<BaseOptionAttribute> optionList)
        {
            int length = 0;
            foreach (BaseOptionAttribute option in optionList)
            {
                int optionLenght = 0;
                bool hasShort = option.HasShortName;
                bool hasLong = option.HasLongName;
                if (hasShort)
                {
                    optionLenght += option.ShortName.Length;
                }
                if (hasLong)
                {
                    optionLenght += option.LongName.Length;
                }
                if (hasShort && hasLong)
                {
                    optionLenght += 2; // ", "
                }
                length = Math.Max(length, optionLenght);
            }
            return length;
        }