只是想知道是否有任何方法可以检查数值A是否等于数组中的任何值(不使用大循环函数) - 有点像"Where"函数.
例如
if (DataRow[column1value] == <any value within>Array A[])
{
//do...
}
Run Code Online (Sandbox Code Playgroud)
干杯!
Luk*_*keH 13
在.NET 3.5或更高版本中,使用LINQ:
bool found = yourArray.Contains(yourValue);
Run Code Online (Sandbox Code Playgroud)
在早期版本的框架中:
bool found = Array.IndexOf(yourArray, yourValue) > -1;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5925 次 |
最近记录: |