ServiceStack.NetStandardPclExportClient.GetValues C# (CSharp) Method

GetValues() private static method

private static GetValues ( WebHeaderCollection headers, string header ) : string[]
headers System.Net.WebHeaderCollection
header string
return string[]
        private static string[] GetValues(WebHeaderCollection headers, string header)
        {
            var value = headers[header];
            
            if (value == null)
                return null;

            if (!multiHeaders.ContainsKey(header))
                return new string[1]{value};

            var tempStringCollection = new List<string>();
 
            bool inquote = false;
            int chIndex = 0;
            char[] vp = new char[value.Length];
            string singleValue;
 
            for (int i = 0; i < value.Length; i++) 
            {
                if (value[i] == '\"') 
                {
                    inquote = !inquote;
                }
                else if ((value[i] == ',') && !inquote) 
                {
                    singleValue = new string(vp, 0, chIndex);
                    tempStringCollection.Add(singleValue.Trim());
                    chIndex = 0;
                    continue;
                }
                vp[chIndex++] = value[i];
            }
 
            if (chIndex != 0) 
            {
                singleValue = new string(vp, 0, chIndex);
                tempStringCollection.Add(singleValue.Trim());
            }
 
            return tempStringCollection.ToArray();
        }
    }