Sorry here is the base link for indexof
http://msdn.microsoft.com/
Main Topics
Browse All TopicsHi all,
I have a problem where I'm loading around 2MB of data either as a string or a byte array and trying to do an "IndexOf" to find the position of certain characters, (not just 1).
Problem is that the .NET "IndexOf" function only works with 2 byte integers, meaning it can only handle up to a number of 32,767. Why did they not create this function to use a 4 byte long? I have written a function to get around this but I have found the same problem with all the other functions:
(for strings)
.SubString
(for byte arrays)
.Skip
.Take
Presume I'm going to have to adapt around this limitation but if someone can find an easy solution that would be great. Here is the re-written IndexOf I have done:
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry here is the base link for indexof
http://msdn.microsoft.com/
That's an interesting bug in the MS knowledge base as also in that page, it references to code which specifically says it's a integer, also VB.NET confirms it's an 2 byte integer value, not an Int32:
Dim instance As String
Dim value As String
Dim returnValue As Integer <------------ Integer
returnValue = instance.IndexOf(value)
I've also tried this already and it fails with any IndexOf searches over 32767.
Business Accounts
Answer for Membership
by: bhmahlerPosted on 2009-10-28 at 07:40:50ID: 25683739
The return value of IndexOf is System.Int32 which is a 4 byte integer en-us/libr ary/k8b147 0s.aspx
http://msdn.microsoft.com/