Beispiel #1
0
        public override bool Equals(UxmlTypeRestriction other)
        {
            UxmlEnumeration uxmlEnumeration = other as UxmlEnumeration;
            bool            flag            = uxmlEnumeration == null;

            return(!flag && this.values.All(new Func <string, bool>(uxmlEnumeration.values.Contains <string>)) && this.values.Count <string>() == uxmlEnumeration.values.Count <string>());
        }
        /// <summary>
        /// Indicates whether the current <see cref="UxmlEnumeration"/> object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">The object to compare with.</param>
        /// <returns>True if the otheer object is equal to this one.</returns>
        public override bool Equals(UxmlTypeRestriction other)
        {
            UxmlEnumeration otherE = other as UxmlEnumeration;

            if (otherE == null)
            {
                return(false);
            }

            return(values.All(otherE.values.Contains) && values.Count() == otherE.values.Count());
        }
Beispiel #3
0
        public UxmlEnumAttributeDescription()
        {
            if (!typeof(T).IsEnum)
            {
                throw new ArgumentException("T must be an enumerated type");
            }

            type          = "string";
            typeNamespace = xmlSchemaNamespace;
            defaultValue  = new T();

            UxmlEnumeration enumRestriction = new UxmlEnumeration();

            var values = new List <string>();

            foreach (T item in Enum.GetValues(typeof(T)))
            {
                values.Add(item.ToString(CultureInfo.InvariantCulture));
            }
            enumRestriction.values = values;

            restriction = enumRestriction;
        }