Dev2.Converters.Dev2BinaryConverter.NeutralizeToCommon C# (CSharp) Method

NeutralizeToCommon() public method

public NeutralizeToCommon ( string payload ) : byte[]
payload string
return byte[]
        public byte[] NeutralizeToCommon(string payload)
        {
            if (payload.Length >= 8)
            {
                var result = new byte[payload.Length/8];

                int pos = 0;
                for (int i = 0; i < payload.Length; i += 8)
                {
                    result[pos] = Convert.ToByte(payload.Substring(i, 8), 2);
                    pos++;
                }

                return result;
            }

            throw new ArgumentException(Resources.Dev2BinaryConverterPayloadToSmallException);
        }