我正在使用VB.Net,并且有两个一维数组。有没有一个内置的函数可以找到它们共有的元素?或者我必须为自己写一篇文章?
发布于 2009-06-12 12:55:42
恐怕您必须自己编写一个,因为.NET 2.0中没有内置函数。
查看this StackOverflow question,了解如何自己实现它。
发布于 2009-06-11 16:39:27
如果可以使用LINQ扩展方法(VB9),那么可以使用Enumerable.Intersect()
dim a as String() = {"blah", "bleak", "blorg", "blue"}
dim b as String() = {"blaah", "bleak", "bleee", "blue"}
' c will contain the intersection, "bleak" and "blue" '
dim c as IEnumerable(Of String) = a.Intersect(b)发布于 2011-11-03 01:16:47
只需为.net 2.0 http://code.google.com/p/linqbridge/downloads/list使用LinqBridge,您就应该能够使用intersect方法。
https://stackoverflow.com/questions/982174
复制相似问题