static bool IsFlagsEnum(Type type) { return type.GetCustomAttributes(typeof(FlagsAttribute), false).Length != 0; }