更新时间:2023-11-29 15:51:46
当然你可以写:
public static class Utils {
public static bool IsAny<T>(this IEnumerable<T> data) {
return data != null && data.Any();
}
}
但是,请注意并非所有序列都是可重复的;通常我更喜欢只走一次,以防万一.
however, be cautious that not all sequences are repeatable; generally I prefer to only walk them once, just in case.