Arrays.Contains seems to not working

Hi All,

I need to have fast search functionality (iterating through an array in managed code is not fast enough for my requirements) so I thought will use Arrays.Contains helper method from GHI.Utilities. However I think it doesn’t work correctly e.g.


using GHI.Utilities;

namespace ArrayContainsTest
{
    public class Program
    {
        public static void Main()
        {
            var searchIn = new byte[5] {8,9,8,0,6};

            var searchFor = new byte[1] {0};

            var result = Arrays.Contains(searchIn, searchFor);

        }
    }
}


The result should have 3 instead of -1 meaning the 0 couldn’t be found.
Another option for me is to implement binary search on array in managed code(serialized objects are fixed size) but hoped this helper method will be fast enough for my needs.

@ vooba - I was able to reproduce the issue, we will take a look for the next SDK. In the mean time, it should be pretty easy to do this in RLP.

@ vooba - This should be fixed in the next SDK.

1 Like

Thanks