BinarySearch找不到项目

BinarySearch找不到项目

本文介绍了Array.BinarySearch找不到项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

For Each t As Test In m_AllTests
Dim name As String = t.Name.ToString.ToLower.Trim
intIndexLocation = Array.BinarySearch(m_key, name)
If intIndexLocation >= 0 Then



我的数组搜索工作正常,但找不到一项. intIndexLocation 尝试搜索该项目时为-1.我已经通过调试器运行了程序,并验证了数组中是否存在该项.有人可以建议其他功能或其他方法来解决此问题吗?谢谢.



My array search works fine except for one item which can''t be found. intIndexLocation is -1 when it tries to search for that item. I have run my program through the debugger and verified that the item is present in the array. Can someone suggest another function or another way to solving this problem? Thank you.

推荐答案




这篇关于Array.BinarySearch找不到项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:51