本文整理汇总了C#中System.Collections.Specialized.OrderedDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# OrderedDictionary.Add方法的具体用法?C# OrderedDictionary.Add怎么用?C# OrderedDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.OrderedDictionary
的用法示例。
在下文中一共展示了OrderedDictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSelectedRowData
public IOrderedDictionary GetSelectedRowData()
{
IOrderedDictionary result;
if (null == this.SelectedRow)
{
result = null;
}
else
{
OrderedDictionary fieldValues = new OrderedDictionary();
foreach (object field in this.CreateColumns(null, false))
{
if (field is BoundField && !fieldValues.Contains(((BoundField)field).DataField))
{
fieldValues.Add(((BoundField)field).DataField, null);
}
}
string[] dataKeyNames = this.DataKeyNames;
for (int i = 0; i < dataKeyNames.Length; i++)
{
string key = dataKeyNames[i];
if (!fieldValues.Contains(key))
{
fieldValues.Add(key, null);
}
}
this.ExtractRowValues(fieldValues, this.SelectedRow, true, true);
result = fieldValues;
}
return result;
}
示例2: EmitCommand
public string EmitCommand(object[] tupleValues, long? tupleId= null, long? taskId = null, string streamid = null)
{
var result = new OrderedDictionary
{
{WellKnownStrings.Command, WellKnownStrings.Emit},
};
if (tupleId.HasValue)
{
result.Add(WellKnownStrings.Id, tupleId.Value.ToString(CultureInfo.InvariantCulture));
}
if (!string.IsNullOrEmpty(streamid))
{
result.Add(WellKnownStrings.Stream, streamid);
}
if (taskId.HasValue)
{
result.Add(WellKnownStrings.Task, taskId.Value);
}
result.Add(WellKnownStrings.Tuple, tupleValues);
return result.ToJson();
}
示例3: PassingEqualityComparers
public void PassingEqualityComparers()
{
var eqComp = new CaseInsensitiveEqualityComparer();
var d1 = new OrderedDictionary(eqComp);
d1.Add("foo", "bar");
Assert.Throws<ArgumentException>(() => d1.Add("FOO", "bar"));
}
示例4: AgregarColonia
public void AgregarColonia(string colonia, string municipio)
{
MySqlDataAccess mysqlAccess = new MySqlDataAccess();
OrderedDictionary listParam = new OrderedDictionary();
listParam.Add("nombreColonia", colonia);
listParam.Add("nombreMunicipio", municipio);
var data = mysqlAccess.ExecuteProcedure("AgregarColonia", listParam);
}
示例5: PrintWithIDictionary
public void PrintWithIDictionary() {
// Arrange
MockObjectVisitor visitor = CreateObjectVisitor();
IDictionary dict = new OrderedDictionary();
dict.Add("foo", "bar");
dict.Add("abc", 500);
// Act
visitor.Print(dict);
// Assert
Assert.AreEqual("foo = bar", visitor.KeyValuePairs[0]);
Assert.AreEqual("abc = 500", visitor.KeyValuePairs[1]);
}
示例6: BuildInstance
public void BuildInstance()
{
SimpleEntity simpleEntity = new SimpleEntity();
OrderedDictionary values = new OrderedDictionary(3);
values.Add("Id", 1);
values.Add("Name", "name");
values.Add("Age", 10);
TypeDescriptionHelper.BuildInstance(values, simpleEntity);
Assert.AreEqual(1, simpleEntity.Id);
Assert.AreEqual("name", simpleEntity.Name);
Assert.AreEqual(10, simpleEntity.Age);
}
示例7: ValidateUser
public bool ValidateUser(string userName, string pass)
{
bool respu = false;
MySqlDataAccess mysqlAccess = new MySqlDataAccess();
OrderedDictionary listParam = new OrderedDictionary();
listParam.Add("userName", userName);
listParam.Add("pass", pass);
var data = mysqlAccess.ExecuteProcedure("ValidarUsuario", listParam);
if (data.Rows.Count > 0)
{
respu = true;
}
return respu;
}
示例8: PollsMainForm
public PollsMainForm(User _user)
{
InitializeComponent();
//_anketsUser=new User();
//_anketsUser.Login = "br_964_avilkovskaya_001";
//_anketsUser.CodMfo = 964;
//_anketsUser.CodObl = 8;
//_anketsUser.CodRKC = 0;
//_anketsUser.PrivilegesCodMfo = 0;
//_anketsUser.PrivilegesCodObl = 6;
//_anketsUser.PrivilegesCodRKC = 0;
//_anketsUser.
_anketsUser = _user;
_deposPollsTable = new DeposPollsTableForm(_anketsUser);
splitContainer1.Panel2.Controls.Add(_deposPollsTable);
_deposPollsTable.Dock = DockStyle.Fill;
settings = global::Poll.Properties.Settings.Default;
//Console.WriteLine(settings.Test);
//settings.Test = "проверка";
//Console.WriteLine(settings.Test);
//MessageBox.Show(settings.Test);
OrderedDictionary ttt = new OrderedDictionary();
foreach (DataColumn t in _deposPollsTable.pollsDataSet.POLL_DEPOS.Columns)
{
ttt.Add(t.ColumnName, "");
//settings.DeposTableColumnsText.Add(t.ColumnName,"");
}
settings.DeposTableColumnsText = ttt;
settings.Save();
//_deposPollsTable.buttonAddPoll.
//Refresh();
Update();
}
示例9: BuildInstanceThrowsIfPropertyIsReadOnly
public void BuildInstanceThrowsIfPropertyIsReadOnly()
{
OrderedDictionary values = new OrderedDictionary(1);
values.Add("Name", "name");
TypeDescriptionHelper.BuildInstance(values, new SimpleEntityWithReadOnlyProperty());
}
示例10: CountTests
public void CountTests()
{
var d = new OrderedDictionary();
Assert.Equal(0, d.Count);
for (int i = 0; i < 1000; i++)
{
d.Add(i, i);
Assert.Equal(i + 1, d.Count);
}
for (int i = 0; i < 1000; i++)
{
d.Remove(i);
Assert.Equal(1000 - i - 1, d.Count);
}
for (int i = 0; i < 1000; i++)
{
d[(object)i] = i;
Assert.Equal(i + 1, d.Count);
}
for (int i = 0; i < 1000; i++)
{
d.RemoveAt(0);
Assert.Equal(1000 - i - 1, d.Count);
}
}
示例11: GetEmoticonHashTable
public OrderedDictionary GetEmoticonHashTable()
{
const string key = "GetEmoticonHashTable";
var emoticons = _cacheService.Get<OrderedDictionary>(key);
if (emoticons == null)
{
emoticons = new OrderedDictionary();
var root = SiteConfig.Instance.GetSiteConfig();
var emoticonNodes = root?.SelectNodes("/forum/emoticons/emoticon");
if (emoticonNodes != null)
{
foreach (XmlNode emoticonNode in emoticonNodes)
{
//<emoticon symbol="O:)" image="angel-emoticon.png" />
if (emoticonNode.Attributes != null)
{
var emoticonSymbolAttr = emoticonNode.Attributes["symbol"];
var emoticonImageAttr = emoticonNode.Attributes["image"];
if (emoticonSymbolAttr != null && emoticonImageAttr != null)
{
emoticons.Add(emoticonSymbolAttr.InnerText, emoticonImageAttr.InnerText);
}
}
}
_cacheService.Set(key, emoticons, CacheTimes.OneDay);
}
}
return emoticons;
}
示例12: CustomTrim
public static OrderedDictionary CustomTrim(this OrderedDictionary source)
{
if (source == null) return null;
var result = new OrderedDictionary();
var keys = source.Keys;
foreach (var key in keys)
{
var value = source[key];
var stringValue = value as string;
if (stringValue != null)
{
value = stringValue.CustomTrim();
}
result.Add(key, value);
}
return result;
}
示例13: ParseParams
/// <summary>
/// Parses the parameters passed to the constructor.
/// </summary>
/// <param name="fields">The object[] passed to the constructor.</param>
/// <exception cref="ArgumentException">Either the length of the params argument is odd, each pair of objects within the params argument do not each comprise a valid <see cref="KeyValuePair{SortBy,SortOrder}"/>, or there is a duplicate <see cref="SortBy"/> key within the params argument.</exception>
private void ParseParams(ref object[] fields)
{
var orderedDictionary = new OrderedDictionary();
// Must have an even number of items in the array.
if (fields.Length % 2 != 0)
{
throw new ArgumentException("There must be an even number of items in the array.");
}
else
{
for (int i = 0; i < fields.Length/2; i++)
{
if (fields[i*2] is SortBy && fields[i*2 + 1] is SortOrder)
{
orderedDictionary.Add((SortBy)fields[i * 2], (SortOrder)fields[i * 2 + 1]);
}
else
{
throw new ArgumentException(
"Each pair of items added to the object array must be a pairing of SortBy then SortOrder.");
}
}
}
OrderedDictionary = orderedDictionary;
}
示例14: DataKeyArray_Item
public void DataKeyArray_Item ()
{
OrderedDictionary dictionary = new OrderedDictionary();
dictionary.Add("key","value");
ArrayList list = new ArrayList ();
DataKey key = new DataKey (dictionary);
list.Add (key);
DataKeyArray keyarray = new DataKeyArray (list);
Assert.AreEqual(1,keyarray.Count,"CreateItems");
Assert.AreEqual (key, keyarray[0], "CreateKeyData");
Assert.AreEqual ("value",((DataKey)keyarray[0]).Value,"KeyArrayValue");
dictionary.Add ("key1", "value1");
key = new DataKey (dictionary);
list.Add (key);
keyarray = new DataKeyArray (list);
Assert.AreEqual (2, keyarray.Count, "CreateItemsMulty");
}
示例15: AgregarLugar
public void AgregarLugar(string lugar)
{
MySqlDataAccess mysqlAccess = new MySqlDataAccess();
OrderedDictionary listParam = new OrderedDictionary();
listParam.Add("nombreLugar", lugar);
var data = mysqlAccess.ExecuteProcedure("AgregarLugar", listParam);
}