Data Types C#

//GNU General Public License version 2 (GPLv2)
//http://walkmen.codeplex.com/license
using System;
using System.Collections.Generic;
using System.Text;
namespace Walkmen.Util
{
    public sealed class ByteUtils
    {
        private ByteUtils()
        {
        }
        public static int IndexOf(byte[] array, byte[] pattern, int offset)
        {
            int success = 0;
            for (int i = offset; i < array.Length; i++)
            {
                if (array[i] == pattern[success])
                {
                    success++;
                }
                else
                {
                    success = 0;
                }
                if (pattern.Length == success)
                {
                    return i - pattern.Length + 1;
                }
            }
            return -1;
        }
    }
}