Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether this tag is subset of <paramref name="other"/>
        /// (meaning each subtag of this tag is also subtag of <paramref name="other"/>)
        /// </summary>
        public bool IsSubsetOf(LanguageTag other)
        {
            if (Language.HasValue && other.Language != Language)
            {
                return(false);
            }

            if (Script.HasValue && other.Script != Script)
            {
                return(false);
            }

            if (Region.HasValue && other.Region != Region)
            {
                return(false);
            }

            if (Variants.Except(other.Variants).Any())
            {
                return(false);
            }

            if (Extensions.Except(other.Extensions).Any())
            {
                return(false);
            }

            return(PrivateUse.IsEmpty || other.PrivateUse == PrivateUse);
        }