From d0a4df8538400e908f57a8c80619df324a742ef9 Mon Sep 17 00:00:00 2001 From: Elivo Date: Thu, 19 Mar 2026 23:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=A9=E5=B1=95=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20item.In(array)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apewer/CollectionUtility.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Apewer/CollectionUtility.cs b/Apewer/CollectionUtility.cs index b074722..e809a2e 100644 --- a/Apewer/CollectionUtility.cs +++ b/Apewer/CollectionUtility.cs @@ -127,6 +127,12 @@ namespace Apewer } } + /// 检查当前元素是否存在于集合。 + public static bool In(this T item, IEnumerable collection) => Contains(collection, item); + + /// 检查当前元素是否存在于集合。 + public static bool In(this T item, params T[] collection) => Contains(collection, item); + #endregion #region 类型转换