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


C# OrderedDictionary.Add方法代码示例

本文整理汇总了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;
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:31,代码来源:DataGridView.cs

示例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();
        }
开发者ID:hairywelly,项目名称:StormMultilangCSharp,代码行数:25,代码来源:JsonProtocolWriterFormat.cs

示例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"));
 }
开发者ID:rajeevkb,项目名称:corefx,代码行数:7,代码来源:OrderedDictionaryTests.cs

示例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);
        }
开发者ID:ntiseira,项目名称:videoAppWpf,代码行数:9,代码来源:AppManager.cs

示例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]);
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:14,代码来源:ObjectInfoTest.cs

示例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);
        }
开发者ID:riseandcode,项目名称:open-wscf-2010,代码行数:14,代码来源:TypeDescriptionHelperFixture.cs

示例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;
 }
开发者ID:ntiseira,项目名称:videoAppWpf,代码行数:14,代码来源:AppManager.cs

示例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();
        }
开发者ID:alexander-gavrilov,项目名称:ussrmyprojects,代码行数:34,代码来源:PollsMainForm.cs

示例9: BuildInstanceThrowsIfPropertyIsReadOnly

        public void BuildInstanceThrowsIfPropertyIsReadOnly()
        {
            OrderedDictionary values = new OrderedDictionary(1);
            values.Add("Name", "name");

            TypeDescriptionHelper.BuildInstance(values, new SimpleEntityWithReadOnlyProperty());
        }
开发者ID:riseandcode,项目名称:open-wscf-2010,代码行数:7,代码来源:TypeDescriptionHelperFixture.cs

示例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);
            }
        }
开发者ID:rajeevkb,项目名称:corefx,代码行数:29,代码来源:OrderedDictionaryTests.cs

示例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;
        }
开发者ID:lenwen,项目名称:mvcforum,代码行数:32,代码来源:ConfigService.cs

示例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;
        }
开发者ID:chiganock,项目名称:VtecTeamFlasher,代码行数:29,代码来源:OrderedDictionaryExtensions.cs

示例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;
		}
开发者ID:adamspicer,项目名称:.NET-MAPI-Wrapper,代码行数:32,代码来源:SortedFieldDictionary.cs

示例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");
		}
开发者ID:nobled,项目名称:mono,代码行数:17,代码来源:DataKeyArrayTest.cs

示例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);
        }
开发者ID:ntiseira,项目名称:videoAppWpf,代码行数:8,代码来源:AppManager.cs


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