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;
}