SonarQube.Common.CommandLineParser.TryGetMatchingPrefix C# (CSharp) Метод

TryGetMatchingPrefix() приватный статический Метод

private static TryGetMatchingPrefix ( SonarQube.Common.ArgumentDescriptor descriptor, string argument ) : string
descriptor SonarQube.Common.ArgumentDescriptor
argument string
Результат string
        private static string TryGetMatchingPrefix(ArgumentDescriptor descriptor, string argument)
        {
            Debug.Assert(descriptor.Prefixes.Count(p => argument.StartsWith(p, ArgumentDescriptor.IdComparison)) < 2,
                "Not expecting the argument to match multiple prefixes");

            string match;
            if (descriptor.IsVerb)
            {
                // Verbs match the whole argument
                match = descriptor.Prefixes.FirstOrDefault(p => ArgumentDescriptor.IdComparer.Equals(p, argument));
            }
            else
            {
                // Prefixes only match the start
                match = descriptor.Prefixes.FirstOrDefault(p => argument.StartsWith(p, ArgumentDescriptor.IdComparison));
            }
            return match;
        }