BTDB.IL.ILDynamicTypeDebugImpl.ShortenIfNeeded C# (CSharp) Method

ShortenIfNeeded() static private method

static private ShortenIfNeeded ( string name, int maxLength ) : string
name string
maxLength int
return string
        internal static string ShortenIfNeeded(string name, int maxLength)
        {
            if (name.Length < maxLength)
                return name;
            var sections = ParseSectionsForNameShortening(name);
            int needRemove = name.Length - maxLength;
            SelectSubsectionsToRemove(name, sections, needRemove);
            var sb = new StringBuilder(maxLength);
            AddNameShorteningSection(name, sections, sections.Count - 1, name.Length, sb);
            return sb.ToString();
        }