/// <summary> /// Sammelt die Namen der in <paramref name="telType"/> gesetzten Flags in /// <paramref name="list"/>. <paramref name="list"/> wird von der Methode nicht /// geleert. /// </summary> /// <param name="telType"><see cref="TelTypes"/>-Objekt oder <c>null</c>.</param> /// <param name="list">Eine Liste zum sammeln.</param> internal static void CollectValueStrings(TelTypes?telType, List <string> list) { Debug.Assert(list != null); if (!telType.HasValue) { return; } TelTypes value = telType.Value & TelTypesConverter.DEFINED_TEL_TYPES_VALUES; for (int i = TelTypesConverter.TelTypesMinBit; i <= TelTypesConverter.TelTypesMaxBit; i++) { TelTypes flag = (TelTypes)(1 << i); if (value.HasFlag(flag)) { list.Add(flag.ToVcfString()); } } }
public static bool IsSet(this TelTypes?value, TelTypes flags) => (value & flags) == flags;
public static TelTypes?Unset(this TelTypes?value, TelTypes flags) { value &= ~flags; return(value == (TelTypes)0 ? null : value); }
public static TelTypes?Set(this TelTypes?value, TelTypes flags) => value.HasValue ? (value.Value | flags) : flags;