예제 #1
0
        private static void ReadStoreValues <T>(string[] values, object storeValue, HttpHeaderParser parser,
                                                ref int currentIndex)
        {
            Contract.Requires(values != null);

            if (storeValue != null)
            {
                List <T> storeValues = storeValue as List <T>;

                if (storeValues == null)
                {
                    values[currentIndex] = parser == null?storeValue.ToString() : parser.ToString(storeValue);

                    currentIndex++;
                }
                else
                {
                    foreach (object item in storeValues)
                    {
                        values[currentIndex] = parser == null?item.ToString() : parser.ToString(item);

                        currentIndex++;
                    }
                }
            }
        }
        private static void ReadStoreValues <T>(
            string[] values,
            object storeValue,
            HttpHeaderParser parser,
            T exclude,
            ref int currentIndex)
        {
            if (storeValue == null)
            {
                return;
            }
            if (!(storeValue is List <T> objList))
            {
                if (!HttpHeaders.ShouldAdd <T>(storeValue, parser, exclude))
                {
                    return;
                }
                values[currentIndex] = parser == null?storeValue.ToString() : parser.ToString(storeValue);

                ++currentIndex;
            }
            else
            {
                foreach (T obj in objList)
                {
                    object storeValue1 = (object)obj;
                    if (HttpHeaders.ShouldAdd <T>(storeValue1, parser, exclude))
                    {
                        values[currentIndex] = parser == null?storeValue1.ToString() : parser.ToString(storeValue1);

                        ++currentIndex;
                    }
                }
            }
        }