if (!Enum.IsDefined(typeof(SearchMode), options))
              throw new ArgumentException(Properties.Resources.InvalidEnumerationValue, "options");

SearchMode为一个枚举类型, 若传入的options值不在此枚举定义范围内, 比如枚举定义了1,2, 而options是由3 cast来的, 则IsDefined方法返回false.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2021-12-27
  • 2021-09-19
  • 2022-12-23
  • 2021-06-24
  • 2022-01-24
猜你喜欢
  • 2022-02-13
  • 2022-12-23
  • 2021-09-07
  • 2022-02-03
  • 2021-07-06
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案