当前位置: 首页>>代码示例>>C#>>正文


C# NameValueCollection.GetValues方法代码示例

本文整理汇总了C#中NameValueCollection.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.GetValues方法的具体用法?C# NameValueCollection.GetValues怎么用?C# NameValueCollection.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NameValueCollection的用法示例。


在下文中一共展示了NameValueCollection.GetValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToQueryString

    public static string ToQueryString(NameValueCollection collection, bool startWithQuestionMark = true)
    {
        if (collection == null || !collection.HasKeys())
            return String.Empty;

        var sb = new StringBuilder();
        if (startWithQuestionMark)
            sb.Append("?");

        var j = 0;
        var keys = collection.Keys;
        foreach (string key in keys)
        {
            var i = 0;
            var values = collection.GetValues(key);
            foreach (var value in values)
            {
                sb.Append(key)
                    .Append("=")
                    .Append(value);

                if (++i < values.Length)
                    sb.Append("&");
            }
            if (++j < keys.Count)
                sb.Append("&");
        }
        return sb.ToString();
    }
开发者ID:timw255,项目名称:Sitefinity-STS-Modification,代码行数:29,代码来源:SimpleWebTokenHandler.cs

示例2: Add

        public void Add()
        {
            NameValueCollection nameValueCollection = new NameValueCollection();
            Assert.False(nameValueCollection.HasKeys());
            for (int i = 0; i < 10; i++)
            {
                string name = "Name_" + i;
                string value = "Value_" + i;
                nameValueCollection.Add(name, value);
                Assert.Equal(i + 1, nameValueCollection.Count);
                Assert.Equal(i + 1, nameValueCollection.AllKeys.Length);
                Assert.Equal(i + 1, nameValueCollection.Keys.Count);

                // We should be able to access values by the name
                Assert.Equal(value, nameValueCollection[name]);
                Assert.Equal(value, nameValueCollection.Get(name));

                Assert.Contains(name, nameValueCollection.AllKeys);
                Assert.Contains(name, nameValueCollection.Keys.Cast<string>());

                Assert.Equal(new string[] { value }, nameValueCollection.GetValues(name));

                // Get(string), GetValues(string) and this[string] should be case insensitive
                Assert.Equal(value, nameValueCollection[name.ToUpperInvariant()]);
                Assert.Equal(value, nameValueCollection[name.ToLowerInvariant()]);

                Assert.Equal(value, nameValueCollection.Get(name.ToUpperInvariant()));
                Assert.Equal(value, nameValueCollection.Get(name.ToLowerInvariant()));

                Assert.Equal(new string[] { value }, nameValueCollection.GetValues(name.ToUpperInvariant()));
                Assert.Equal(new string[] { value }, nameValueCollection.GetValues(name.ToLowerInvariant()));

                Assert.DoesNotContain(name.ToUpperInvariant(), nameValueCollection.AllKeys);
                Assert.DoesNotContain(name.ToLowerInvariant(), nameValueCollection.AllKeys);

                Assert.DoesNotContain(name.ToUpperInvariant(), nameValueCollection.Keys.Cast<string>());
                Assert.DoesNotContain(name.ToLowerInvariant(), nameValueCollection.Keys.Cast<string>());

                // We should be able to access values and keys in the order they were added
                Assert.Equal(value, nameValueCollection[i]);
                Assert.Equal(value, nameValueCollection.Get(i));
                Assert.Equal(name, nameValueCollection.GetKey(i));
                Assert.Equal(new string[] { value }, nameValueCollection.GetValues(i));
            }
            Assert.True(nameValueCollection.HasKeys());
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:46,代码来源:NameValueCollection.AddStringStringTests.cs

示例3: GetHeader

    public String GetHeader(NameValueCollection Name)
    {
        String D = "";
           for(int i = 0; i <  Name.Count - 1; i++){

            D = D + Name.Keys[i] + "=" + Name.GetValues(i)[0];

           }
           return D.Replace("'", "\"");
    }
开发者ID:krikelin,项目名称:Fakturaadress,代码行数:10,代码来源:Fakturaadress.cs

示例4: Item_Set_OvewriteExistingValue

        public void Item_Set_OvewriteExistingValue()
        {
            NameValueCollection nameValueCollection = new NameValueCollection();
            string name = "name";
            string value = "value";
            nameValueCollection.Add(name, "old-value");

            nameValueCollection[name] = value;
            Assert.Equal(value, nameValueCollection[name]);
            Assert.Equal(new string[] { value }, nameValueCollection.GetValues(name));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:11,代码来源:NameValueCollection.SetItemTests.cs

示例5: Add_NullName

        public void Add_NullName()
        {
            NameValueCollection nameValueCollection = new NameValueCollection();
            string value = "value";
            nameValueCollection.Add(null, value);
            Assert.Equal(1, nameValueCollection.Count);
            Assert.Equal(1, nameValueCollection.AllKeys.Length);
            Assert.Equal(1, nameValueCollection.Keys.Count);

            Assert.Contains(null, nameValueCollection.AllKeys);
            Assert.Contains(null, nameValueCollection.Keys.Cast<string>());

            Assert.Equal(value, nameValueCollection[null]);
            Assert.Equal(value, nameValueCollection.Get(null));

            Assert.Equal(value, nameValueCollection[0]);
            Assert.Equal(value, nameValueCollection.Get(0));

            Assert.Equal(new string[] { value }, nameValueCollection.GetValues(null));
            Assert.Equal(new string[] { value }, nameValueCollection.GetValues(0));

            Assert.Null(nameValueCollection.GetKey(0));
            Assert.False(nameValueCollection.HasKeys());
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:24,代码来源:NameValueCollection.AddStringStringTests.cs

示例6: Add_ExistingKeys

        public void Add_ExistingKeys()
        {
            NameValueCollection nameValueCollection1 = new NameValueCollection();
            NameValueCollection nameValueCollection2 = new NameValueCollection();

            string name = "name";
            string value1 = "value1";
            string value2 = "value2";
            nameValueCollection1.Add(name, value1);
            nameValueCollection2.Add(name, value2);

            nameValueCollection2.Add(nameValueCollection1);
            Assert.Equal(1, nameValueCollection2.Count);
            Assert.Equal(value2 + "," + value1, nameValueCollection2[name]);
            Assert.Equal(new string[] { value2, value1 }, nameValueCollection2.GetValues(name));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:16,代码来源:NameValueCollection.AddNVCTests.cs

示例7: Initialise

        private void Initialise(NameValueCollection settings)
        {
            var editableCollection =
                new EditableKeyValueCollection(
                    settings.SelectMany(
                        key => settings.GetValues(key).Select(
                            value => new EditableKeyValue()
                                         {
                                             Key = key,
                                             Value = value,
                                         })));

            editableCollection.KeyValueChanged += delegate { OnChanged(EventArgs.Empty); };
            editableCollection.CollectionChanged += delegate { OnChanged(EventArgs.Empty); };

            EditableValues = editableCollection;
            AddEmptyItem();
        }
开发者ID:hibernating-rhinos,项目名称:RavenFS,代码行数:18,代码来源:NameValueCollectionEditorModel.cs

示例8: AddOperationHeaders

		/// <summary>
		/// Adds the operation headers.
		/// </summary>
		/// <param name="operationsHeaders">The operations headers.</param>
		public CreateHttpJsonRequestParams AddOperationHeaders(NameValueCollection operationsHeaders)
		{
			urlCached = null;
			operationsHeadersCollection = operationsHeaders;
			foreach (string operationsHeader in operationsHeadersCollection)
			{
				operationHeadersHash = (operationHeadersHash * 397) ^ operationsHeader.GetHashCode();
				var values = operationsHeaders.GetValues(operationsHeader);
				if (values == null) 
					continue;

				foreach (var header in values.Where(header => header != null))
				{
					operationHeadersHash = (operationHeadersHash * 397) ^ header.GetHashCode();
				}
			}
			return this;
		}
开发者ID:925coder,项目名称:ravendb,代码行数:22,代码来源:CreateHttpJsonRequestParams.cs

示例9: runTest


//.........这里部分代码省略.........
         string k = "keykey";
         string k1 = "hm1";
         string exp = "";
         string exp1 = "";
         for (int i = 0; i < len; i++) 
         {
             nvc.Add(k, "Value"+i);
             nvc.Add(k1, "iTem"+i);
             if (i < len-1) 
             {
                 exp += "Value"+i+",";
                 exp1 += "iTem"+i+",";
             }
             else  
             {
                 exp += "Value"+i;
                 exp1 += "iTem"+i;
             }
         }
         if (nvc.Count != 2) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0007a, count is {0} instead of {1}", nvc.Count, 2);
         }
         nvc1.Clear();
         nvc1.Add(nvc); 
         Console.WriteLine(" - item with 0-th key");
         iCountTestcases++;
         if ( String.Compare(nvc1[k], exp, false) != 0 ) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0007b, returned \"{0}\" instead of \"{1}\"", nvc1[k], exp);
         } 
         if ( nvc1.GetValues(k).Length != len ) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0007c, number of values is {0} instead of {1}", nvc1.GetValues(k).Length, len);
         } 
         for (int i = 0; i < len; i++) 
         {
             if ( String.Compare(nvc1.GetValues(k)[i], "Value"+i, false) != 0 ) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0007_{0}_d, returned {1} instead of {2}", i, nvc1.GetValues(k)[i], "Value"+i);
             }  
         } 
         Console.WriteLine(" - item with 1-st key");
         if ( String.Compare(nvc1[k1], exp1, false) != 0 ) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0007e, returned \"{0}\" instead of \"{1}\"", nvc1[k1], exp1);
         }  
         iCountTestcases++;
         if ( nvc1.GetValues(k1).Length != len ) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0007f, number of values is {0} instead of {1}", nvc1.GetValues(k1).Length, len);
         }  
         for (int i = 0; i < len; i++) 
         {
             if ( String.Compare(nvc1.GetValues(k1)[i], "iTem"+i, false) != 0 ) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0007_{0}_g, returned {1} instead of {2}", i, nvc1.GetValues(k1)[i], "iTem"+i);
             }  
         } 
开发者ID:ArildF,项目名称:masters,代码行数:67,代码来源:co8776add_nvc.cs

示例10: SetQueryString

    /// <summary>
    /// QuseryString處理
    /// </summary>
    /// <param name="dic">預設參數</param>
    /// <param name="dicAdd">新增參數</param>
    /// <param name="strRemove">移除參數</param>
    /// <returns>組成QuseryString</returns>
    public static string SetQueryString(bool isClear, Dictionary<string, string> dic, Dictionary<string, string> dicAdd, string[] strRemove)
    {
        StringBuilder sbQueryString = new StringBuilder();
        NameValueCollection nvc = new NameValueCollection();
        //如不清除原本的參數,並取得目前的QueryString轉為NameValueCollection物件
        if (!isClear & HttpContext.Current.Request.QueryString.Count > 0)
        {
            nvc.Add(HttpContext.Current.Request.QueryString);
        }

        //加入預設參數
        foreach (KeyValuePair<string, string> kvp in dic)
        {
            nvc.Add(kvp.Key, kvp.Value);
        }
        //新增參數
        if (dicAdd != null)
        {
            foreach (KeyValuePair<string, string> kvp in dicAdd)
            {
                nvc.Add(kvp.Key, kvp.Value);
            }
        }
        //移除參數
        if (strRemove != null)
        {
            foreach (string strKey in strRemove)
            {
                nvc.Remove(strKey);
            }
        }
        //轉回組成QueryString
        foreach (string strKey in nvc.AllKeys)
        {
            string[] strValues = nvc.GetValues(strKey);
            foreach (string strValue in strValues)
            {
                sbQueryString.Append(("&" + strKey + "=") + HttpUtility.UrlEncode(strValue));
            }
        }
        //第一個字元處理
        if (sbQueryString.Length > 0)
        {
            sbQueryString.Remove(0, 1);

            sbQueryString.Insert(0, "?");
        }
        return sbQueryString.ToString();
    }
开发者ID:AdamsChao,项目名称:netdb-localdev-proj,代码行数:56,代码来源:IMAUtil.cs

示例11: Button2_Click

 protected void Button2_Click(object sender, EventArgs e)
 {
     NameValueCollection values = new NameValueCollection(base.Request.Form);
     base.Response.Write(values.GetValues("file1")[0].ToString());
 }
开发者ID:SoMeTech,项目名称:SoMeRegulatory,代码行数:5,代码来源:UpLoadImg.aspx.cs

示例12: getFileMimeType


//.........这里部分代码省略.........
        mimes.Add("xht", "application/xhtml+xml");
        mimes.Add("zip", "application/zip");
        mimes.Add("au", "audio/basic");
        mimes.Add("snd", "audio/basic");
        mimes.Add("mid", "audio/midi");
        mimes.Add("midi", "audio/midi");
        mimes.Add("kar", "audio/midi");
        mimes.Add("mpga", "audio/mpeg");
        mimes.Add("mp2", "audio/mpeg");
        mimes.Add("mp3", "audio/mpeg");
        mimes.Add("aif", "audio/x-aiff");
        mimes.Add("aiff", "audio/x-aiff");
        mimes.Add("aifc", "audio/x-aiff");
        mimes.Add("m3u", "audio/x-mpegurl");
        mimes.Add("ram", "audio/x-pn-realaudio");
        mimes.Add("rm", "audio/x-pn-realaudio");
        mimes.Add("rpm", "audio/x-pn-realaudio-plugin");
        mimes.Add("ra", "audio/x-realaudio");
        mimes.Add("wav", "audio/x-wav");
        mimes.Add("pdb", "chemical/x-pdb");
        mimes.Add("xyz", "chemical/x-xyz");
        mimes.Add("bmp", "image/bmp");
        mimes.Add("gif", "image/gif");
        mimes.Add("ief", "image/ief");
        mimes.Add("jpeg", "image/jpeg");
        mimes.Add("jpg", "image/jpgg");
        mimes.Add("jpe", "image/jpeg");
        mimes.Add("png", "image/png");
        mimes.Add("tiff", "image/tiff");
        mimes.Add("tif", "image/tif");
        mimes.Add("djvu", "image/vnd.djvu");
        mimes.Add("djv", "image/vnd.djvu");
        mimes.Add("wbmp", "image/vnd.wap.wbmp");
        mimes.Add("ras", "image/x-cmu-raster");
        mimes.Add("pnm", "image/x-portable-anymap");
        mimes.Add("pbm", "image/x-portable-bitmap");
        mimes.Add("pgm", "image/x-portable-graymap");
        mimes.Add("ppm", "image/x-portable-pixmap");
        mimes.Add("rgb", "image/x-rgb");
        mimes.Add("xbm", "image/x-xbitmap");
        mimes.Add("xpm", "image/x-xpixmap");
        mimes.Add("xwd", "mage/x-windowdump");
        mimes.Add("iges", "model/iges");
        mimes.Add("msh", "model/mesh");
        mimes.Add("mesh", "model/mesh");
        mimes.Add("silo", "model/mesh");
        mimes.Add("wrl", "model/vrml");
        mimes.Add("vrml", "model/vrml");
        mimes.Add("css", "text/css");
        mimes.Add("html", "text/html");
        mimes.Add("htm", "text/html");
        mimes.Add("asc", "text/plain");
        mimes.Add("txt", "text/plain");
        mimes.Add("rtx", "text/richtext");
        mimes.Add("rtf", "text/rtf");
        mimes.Add("sgml", "text/sgml");
        mimes.Add("sgm", "text/sgml");
        mimes.Add("tsv", "text/tab-seperated-values");
        mimes.Add("wml", "text/vnd.wap.wml");
        mimes.Add("wmls", "text/vnd.wap.wmlscript");
        mimes.Add("etx", "text/x-setext");
        mimes.Add("xml", "text/xml");
        mimes.Add("xsl", "text/xml");
        mimes.Add("mpeg", "video/mpeg");
        mimes.Add("mpg", "video/mpeg");
        mimes.Add("mpe", "video/mpeg");
        mimes.Add("qt", "video/quicktime");
        mimes.Add("mov", "video/quicktime");
        mimes.Add("mxu", "video/vnd.mpegurl");
        mimes.Add("avi", "video/x-msvideo");
        mimes.Add("movie", "video/x-sgi-movie");
        mimes.Add("ice", "x-conference-xcooltalk");
        string item = string.Empty;
        try
        {//
            if (mimes.GetValues(extension) != null)
            {
                foreach (string item_loopVariable in new NameValueCollection(mimes))
                {
                    item = item_loopVariable;
                    // mime found
                    if (requests[item] == extension)
                    {
                        return requests[item];
                    }
                }

            }
            else
            {
                // mime not found
                throw new Exception("Mime for ." + extension + " not found");
            }
        }
        catch (Exception e)
        {//
            e.ToString();
        }
        return "";
    }
开发者ID:shiftplanning,项目名称:asp-sdk,代码行数:101,代码来源:shiftPlaning.cs

示例13: runTest

 public virtual bool runTest()
 {
     Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver: " + s_strDtTmVer);
     int iCountErrors = 0;
     int iCountTestcases = 0;
     IntlStrings intl;
     String strLoc = "Loc_000oo";
     NameValueCollection nvc; 
     string [] vls;          
     string [] values = 
     {
         "",
         " ",
         "a",
         "aA",
         "text",
         "     SPaces",
         "1",
         "$%^#",
         "2222222222222222222222222",
         System.DateTime.Today.ToString(),
         Int32.MaxValue.ToString()
     };
     string [] keys = 
     {
         "zero",
         "oNe",
         " ",
         "",
         "aa",
         "1",
         System.DateTime.Today.ToString(),
         "$%^#",
         Int32.MaxValue.ToString(),
         "     spaces",
         "2222222222222222222222222"
     };
     int cnt = 0;            
     try
     {
         intl = new IntlStrings(); 
         Console.WriteLine("--- create collection ---");
         strLoc = "Loc_001oo"; 
         iCountTestcases++;
         nvc = new NameValueCollection();
         Console.WriteLine("1. GetValues() on empty collection");
         iCountTestcases++;
         Console.WriteLine("     - GetValues(-1)");
         try 
         {
             vls = nvc.GetValues(-1);
             iCountErrors++;
             Console.WriteLine("Err_0001a, no exception");
         }
         catch (ArgumentOutOfRangeException ex) 
         {
             Console.WriteLine("  Expected exception: {0}", ex.Message);
         }
         catch (Exception e) 
         {
             iCountErrors++;
             Console.WriteLine("Err_001b, unexpected exception: {0}", e.ToString());
         }
         iCountTestcases++;
         Console.WriteLine("     - GetValues(0)");
         try 
         {
             vls = nvc.GetValues(0);
             iCountErrors++;
             Console.WriteLine("Err_0001c, no exception");
         }
         catch (ArgumentException ex) 
         {
             Console.WriteLine("  Expected exception: {0}", ex.Message);
         }
         catch (Exception e) 
         {
             iCountErrors++;
             Console.WriteLine("Err_001d, unexpected exception: {0}", e.ToString());
         }
         Console.WriteLine("2. add simple strings access them via GetValues()");
         strLoc = "Loc_002oo"; 
         iCountTestcases++;
         cnt = nvc.Count;
         int len = values.Length;
         for (int i = 0; i < len; i++) 
         {
             nvc.Add(keys[i], values[i]);
         }
         if (nvc.Count != len) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0002a, count is {0} instead of {1}", nvc.Count, values.Length);
         } 
         for (int i = 0; i < len; i++) 
         {
             iCountTestcases++;
             vls = nvc.GetValues(i);
             if (vls.Length != 1) 
             {
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:co8728getvalues_int.cs

示例14: runTest


//.........这里部分代码省略.........
             if (!caseInsensitive && Array.IndexOf(nvc.AllKeys, intlValuesLower[i+len]) >= 0) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0004_{0}d, key was converted to lower", i);
             }
         }
         Console.WriteLine("5. AllKeys for multiple strings with the same key");
         nvc.Clear();
         len = values.Length;
         string k = "keykey";
         iCountTestcases++;
         for (int i = 0; i < len; i++) 
         {
             nvc.Add(k, "Value"+i);
             iCountTestcases++;
             if (nvc.Count != 1) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0005_{1}_a, count is {0} instead of 1", nvc.Count, i);
             } 
             iCountTestcases++;
             if (nvc.AllKeys.Length != 1) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0005_{1}_b, AllKeys contains {0} instead of 1", nvc.AllKeys.Length, i);
             } 
             iCountTestcases++;
             if (Array.IndexOf(nvc.AllKeys, k) != 0 ) 
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0005_{0}_c, wrong key", i);
             } 
         }
         string [] vals = nvc.GetValues(k);
         if (vals.Length != len) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0005d, number of values at given key is {0} instead of {1}", vals.Length, 1);
         }
         Console.WriteLine("6. AllKeys when collection has null-value ");
         strLoc = "Loc_006oo"; 
         iCountTestcases++;
         k = "kk";
         nvc.Remove(k);      
         cnt = nvc.Count;
         Console.WriteLine(" initial number of items: " + cnt);
         nvc.Add(k, null);
         iCountTestcases++;
         if (nvc.Count != cnt+1) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0006a, count is {0} instead of {1}", nvc.Count, cnt+1);
         } 
         iCountTestcases++;
         if (Array.IndexOf(nvc.AllKeys, k) < 0) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0006b, collection doesn't contain key of new item");
         } 
         iCountTestcases++;
         if (nvc[k] != null) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0006c, returned non-null on place of null");
         }
         Console.WriteLine("7. AllKeys when item with null-key is present ");
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:67,代码来源:co8733get_allkeys.cs

示例15: runTest


//.........这里部分代码省略.........
         iCountTestcases++;
         if (nvc.Count != nvc1.Count) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0005.1, Count = {0} instead of {1}", nvc.Count, nvc1.Count);
         }
         Console.WriteLine("5.2. check Capacity");
         string [] keys1 = nvc1.AllKeys;
         string [] keys = nvc.AllKeys; 
         Console.WriteLine("5.3. check Keys");
         iCountTestcases++;
         if (keys1.Length != keys.Length) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0005.3a, new collection  Keys.Length is {0} instead of {1}", keys.Length, keys1.Length);
         }
         else 
         {
             for (int i = 0; i < keys1.Length; i++) 
             {
                 iCountTestcases++;
                 if ( Array.IndexOf(keys, keys1[i]) < 0 )  
                 {
                     iCountErrors++;
                     Console.WriteLine("Err_0005.3b_{0}, no key \"{1}\" in AllKeys", i, keys1[i] );
                 }
             }
         }
         Console.WriteLine("5.4. check Values");
         iCountTestcases++;
         for (int i = 0; i < keys.Length; i++) 
         {
             iCountTestcases++;
             string [] val = nvc.GetValues(keys[i]);
             if ( (val.Length != 1) || String.Compare(val[0], (nvc1.GetValues(keys[i]))[0], false) != 0  )  
             {
                 iCountErrors++;
                 Console.WriteLine("Err_0005.4_{0}, unexpected value at key \"{1}\"", i, keys1[i] );
             }
         }
         Console.WriteLine("6. Create from filled collection - count capacity ");
         len = values.Length;
         strLoc = "Loc_006oo"; 
         iCountTestcases++;
         Console.WriteLine(" - new ({0}, other_collection_Count_{1})", len, nvc1.Count );
         nvc = new NameValueCollection(len, nvc1);
         Console.WriteLine("6.1. check Count");
         iCountTestcases++;
         if (nvc.Count != nvc1.Count) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0006.1, Count = {0} instead of {1}", nvc.Count, nvc1.Count);
         }
         Console.WriteLine("6.2. check Capacity");
         keys1 = nvc1.AllKeys;
         keys = nvc.AllKeys; 
         Console.WriteLine("6.3. check Keys");
         iCountTestcases++;
         if (keys1.Length != keys.Length) 
         {
             iCountErrors++;
             Console.WriteLine("Err_0006.3a, new collection  Keys.Length is {0} instead of {1}", keys.Length, keys1.Length);
         }
         else 
         {
             for (int i = 0; i < keys1.Length; i++) 
开发者ID:ArildF,项目名称:masters,代码行数:67,代码来源:co8721ctor_int_nvc.cs


注:本文中的NameValueCollection.GetValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。