as。在.net 2中的Array.Any [英] as Array.Any in .net 2
本文介绍了as。在.net 2中的Array.Any的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨每一个
不幸的是,ArrayName.Any在.net 2中不存在
那么.net 2中的命令就像那样。
我的例子是:
hi Every one
Unfortunately ArrayName.Any not exist in .net 2
So what command is like that in .net 2
My Example is :
Private ArraySides() As String = {"Out Side", "Up Down", "Top Buttom"}
Dim StrSide as String="This is Out Side"
If ArraySides.Any(Function(s) StrSide.Contains(s)) Then
end if
谢谢。
Thank you.
推荐答案
在.NET V3.5之前没有Linq方法可用,所以你不能使用它们完全没有。
但你所要做的就是用For Each循环自己重新创建它:
No Linq methods are available prior to .NET V3.5, so you can''t use them at all.
But all you have to do is recreate it yourself with a For Each loop:
Dim ArraySides As String() = {"Out Side", "Up Down", "Top Buttom"}
Dim StrSide As String = "This is Out Side"
Dim isAnyOf As Boolean = False
For Each s As String In ArraySides
If StrSide.Contains(s) Then
isAnyOf = True
Exit For
End If
Next
If isAnyOf Then
...
End If
这篇关于as。在.net 2中的Array.Any的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文