本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.BaseGet方法的典型用法代码示例。如果您正苦于以下问题:C# NameValueCollection.BaseGet方法的具体用法?C# NameValueCollection.BaseGet怎么用?C# NameValueCollection.BaseGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了NameValueCollection.BaseGet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add (NameValueCollection c)
{
if (this.IsReadOnly)
throw new NotSupportedException ("Collection is read-only");
if (c == null)
throw new ArgumentNullException ("c");
// make sense - but it's not the exception thrown
// throw new ArgumentNullException ();
InvalidateCachedArrays ();
int max = c.Count;
for (int i=0; i < max; i++){
string key = c.GetKey (i);
ArrayList new_values = (ArrayList) c.BaseGet (i);
ArrayList values = (ArrayList) BaseGet (key);
if (values != null && new_values != null)
values.AddRange (new_values);
else if (new_values != null)
values = new ArrayList (new_values);
BaseSet (key, values);
}
}
示例2: Add
// Add the contents of another name/value collection to this collection.
public void Add(NameValueCollection c)
{
if(c == null)
{
throw new ArgumentNullException("c");
}
int count = c.Count;
int posn;
String name;
ArrayList strings;
for(posn = 0; posn < count; ++posn)
{
name = c.BaseGetKey(posn);
strings = (ArrayList)(c.BaseGet(posn));
foreach(String value in strings)
{
Add(name, value);
}
}
}