System.Data.Common.ADP.LiteralValueIsInvalid(string)

Here are the examples of the csharp api class System.Data.Common.ADP.LiteralValueIsInvalid(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: referencesource
Source File: AdapterUtil.cs
View license
static internal byte[] ByteArrayFromString(string hexString, string dataTypeName) {
            if ((hexString.Length & 0x1) != 0) {
                throw ADP.LiteralValueIsInvalid(dataTypeName);
            }
            char[]  c = hexString.ToCharArray();
            byte[]  b = new byte[hexString.Length / 2];

            CultureInfo invariant = CultureInfo.InvariantCulture;
            for (int i = 0; i < hexString.Length; i += 2) {
                int h = hexDigits.IndexOf(Char.ToLower(c[i], invariant));
                int l = hexDigits.IndexOf(Char.ToLower(c[i+1], invariant));

                if (h < 0 || l < 0) {
                    throw ADP.LiteralValueIsInvalid(dataTypeName);
                }
                b[i/2] = (byte)((h << 4) | l);
            }
            return b;
        }