Exemple #1
0
        internal static object MultiValuedStringKeyGetter(IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            if (offset < 0 || offset > 2)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            MultiValuedProperty <string> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <string>;

            if (multiValuedProperty == null || multiValuedProperty.Count == 0)
            {
                return(string.Empty);
            }
            string tag   = offset.ToString("d1") + AuthConfigSchema.NameValueSeparator;
            string text  = string.Empty;
            string text2 = multiValuedProperty.SingleOrDefault((string s) => s.StartsWith(tag));

            if (text2 != null && text2.Length > tag.Length)
            {
                text = text2.Substring(tag.Length);
            }
            if (!string.IsNullOrEmpty(text))
            {
                return(text);
            }
            if (multiValuedProperty.Count == 1 && offset == 0)
            {
                text = multiValuedProperty[0];
            }
            return(text);
        }