Beispiel #1
0
        public static EnumerationAndFlags AddFlagIfItExistsInAllEnumerations(this EnumerationAndFlags flags, string key)
        {
            if (flags.AllEnumerations.Any(f => f.Key == key))
            {
                flags.AddFlag(flags.AllEnumerations.Single(x => x.Key == key));
            }

            return(flags);
        }
Beispiel #2
0
        public static EnumerationAndFlags AddFlagsIfTheyExistInAllEnumerations(this EnumerationAndFlags flags, List <string> keys)
        {
            keys = keys ?? new List <string>();
            var knownKeys = keys.Where(key => flags.AllEnumerations.Any(f => f.Key == key)).ToList();

            foreach (var key in knownKeys)
            {
                flags.AddFlag(flags.AllEnumerations.Single(x => x.Key == key));
            }

            return(flags);
        }