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


C# Specialized.OrderedDictionary类代码示例

本文整理汇总了C#中System.Collections.Specialized.OrderedDictionary的典型用法代码示例。如果您正苦于以下问题:C# OrderedDictionary类的具体用法?C# OrderedDictionary怎么用?C# OrderedDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PrintDictionary

 private void PrintDictionary(OrderedDictionary dic)
 {
     foreach (DictionaryEntry entry in dic)
     {
         Output.WriteLine("{0}-{1}", entry.Key, entry.Value);
     }
 }
开发者ID:devlights,项目名称:Sazare,代码行数:7,代码来源:OrderedDictionarySample01.cs

示例2: languageSearchSettings

		public virtual IEnumerable languageSearchSettings()
		{
			var cache = LanguageSearchSettings.Cache;
			var oldDirtyValue = cache.IsDirty;
			foreach (PXResult<SMLanguageSearchSettings, WikiPageLanguage> record in
				PXSelectJoinGroupBy<SMLanguageSearchSettings,
					RightJoin<WikiPageLanguage, On<WikiPageLanguage.language, Equal<SMLanguageSearchSettings.name>>>,
					Where<SMLanguageSearchSettings.userID, IsNull,
						Or<SMLanguageSearchSettings.userID, Equal<Current<AccessInfo.userID>>>>,
					Aggregate<GroupBy<WikiPageLanguage.language, 
						GroupBy<SMLanguageSearchSettings.userID, 
						GroupBy<SMLanguageSearchSettings.active>>>>>.
					Select(this))
			{
				var langSettings = (SMLanguageSearchSettings)record;
				var pageLanguage = (WikiPageLanguage)record;
				if (langSettings.UserID == null)
				{
					var fieldValues = new OrderedDictionary
					                  	{
					                  		{cache.GetField(typeof(SMLanguageSearchSettings.name)), pageLanguage.Language},
					                  		{cache.GetField(typeof(SMLanguageSearchSettings.userID)), PXAccess.GetUserID()},
					                  		{cache.GetField(typeof(SMLanguageSearchSettings.active)), false}
					                  	};
					cache.Insert(fieldValues);
					langSettings = (SMLanguageSearchSettings)cache.Current;
				}
				yield return langSettings;
			}
			cache.IsDirty = oldDirtyValue;
		}
开发者ID:PavelMPD,项目名称:SimpleProjects,代码行数:31,代码来源:MyProfileMaint.cs

示例3: 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:EMPIR,项目名称:brightcove,代码行数:32,代码来源:SortedFieldDictionary.cs

示例4: CreateFinders

		private static OrderedDictionary CreateFinders()
		{
			OrderedDictionary createFinders = new OrderedDictionary();
			createFinders[typeof(MenuStrip)] = (Find<MenuStrip>)delegate(MenuStrip menu, string name)
			{
				foreach (ToolStripItem item in menu.Items)
				{
					if (item.Name == name)
						return item;
					object recursed = FindFirst(item, name);
					if (recursed != null)
						return recursed;
				}
				return null;
			};
			createFinders[typeof(ToolStripItem)] = (Find<ToolStripMenuItem>)delegate(ToolStripMenuItem rootItem, string name)
			{
				foreach (ToolStripItem item in rootItem.DropDownItems)
				{
					if (item.Name == name)
						return item;
					object recursed = FindFirst(item, name);
					if (recursed != null)
						return recursed;
				}
				return null;
			};
			return createFinders;
		}
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:29,代码来源:MenuExtensions.cs

示例5: UpdateCartItems

        public List<CartItem> UpdateCartItems()
        {
            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
            {
                String cartId = usersShoppingCart.GetCartId();

                ShoppingCartActions.ShoppingCartUpdates[] cartUpdates = new ShoppingCartActions.ShoppingCartUpdates[CartList.Rows.Count];
                for (int i = 0; i < CartList.Rows.Count; i++)
                {
                    IOrderedDictionary rowValues = new OrderedDictionary();
                    rowValues = GetValues(CartList.Rows[i]);
                    cartUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductID"]);

                    CheckBox cbRemove = new CheckBox();
                    cbRemove = (CheckBox)CartList.Rows[i].FindControl("Remove");
                    cartUpdates[i].RemoveItem = cbRemove.Checked;

                    TextBox quantityTextBox = new TextBox();
                    quantityTextBox = (TextBox)CartList.Rows[i].FindControl("PurchaseQuantity");
                    cartUpdates[i].PurchaseQuantity = Convert.ToInt16(quantityTextBox.Text.ToString());
                    if (!usersShoppingCart.CheckAvailability(cartUpdates[i].PurchaseQuantity, cartUpdates[i].ProductId, cartId))
                    {
                        // Reload the page.
                        string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count());
                        Response.Redirect(pageUrl + "?Action=stock&id=" + cartUpdates[i].ProductId);
                    }

                }
                usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates);
                CartList.DataBind();
                lblTotal.Text = String.Format("{0:c}", usersShoppingCart.GetTotal());
                return usersShoppingCart.GetCartItems();
            }
        }
开发者ID:MhdNZ,项目名称:MenStore,代码行数:34,代码来源:ShoppingCart.aspx.cs

示例6: GetEmoticonHashTable

        public static OrderedDictionary GetEmoticonHashTable()
        {
            var emoticons = new OrderedDictionary
            {
                {":D", "big-smile-emoticon-for-facebook.png"},
                {":O", "surprised-emoticon.png"},
                {":/", "unsure-emoticon.png"},  
                {":P", "facebook-tongue-out-emoticon.png"},
                {":)", "facebook-smiley-face-for-comments.png"},                
                {":(", "facebook-frown-emoticon.png"},
                {":'(", "facebook-cry-emoticon-crying-symbol.png"},
                {"O:)", "angel-emoticon.png"},
                {"3:)", "devil-emoticon.png"},              
                {"-_-", "squinting-emoticon.png"},
                {":*", "kiss-emoticon.png"},
                {"^_^", "kiki-emoticon.png"},                
                {":v", "pacman-emoticon.png"},
                {":3", "curly-lips-emoticon.png"},
                {"o.O", "confused-emoticon-wtf-symbol-for-facebook.png"},
                {";)", "wink-emoticon.png"},
                {"8-)", "glasses-emoticon.png"},
                {"8| B|", "sunglasses-emoticon.png"}
                //{">:O", "angry-emoticon.png"},
                //{">:(", "grumpy-emoticon.png"}
            };

            return emoticons;
        }
开发者ID:huchao007,项目名称:mvcforum,代码行数:28,代码来源:EmoticonUtils.cs

示例7: LoadAll

        /// <summary>
        /// Load widgets from the assembly provided.
        /// </summary>
        /// <param name="filePath">File path containing the model definitions</param>
        /// <param name="assemblyNamesDelimited">Comma delimited list of assembly names to load modeldefs from.</param>
        /// <param name="author">Override author</param>
        /// <param name="email">Override email</param>
        /// <param name="version">Override version</param>
        /// <param name="url">Ovverride url</param>
        /// <returns></returns>
        public static IList<ModelSettings> LoadAll(string filePath, string assemblyNamesDelimited, string author = "kishore reddy", string email = "[email protected]", string version = "0.9.4.1", string url = "http://commonlibrarynetcms.codeplex.com")
        {
            bool fileProvided = !string.IsNullOrEmpty(filePath);
            bool hasAssemblys = !string.IsNullOrEmpty(assemblyNamesDelimited);

            if (!fileProvided && !hasAssemblys)
                throw new ArgumentException("File path for model defs or list of assembly names must be provided.");

            var models = new OrderedDictionary();
            if (hasAssemblys)
            {   
                // Any loaded from assembly? Load into dictionary.
                var modelDefsFromAssembly = LoadFromAssemblies(assemblyNamesDelimited);
                if (modelDefsFromAssembly != null && modelDefsFromAssembly.Count > 0)
                    foreach (var modelDef in modelDefsFromAssembly)
                        models[modelDef.Value.Name] = modelDef.Value;
                    
            }
            // Model definition config file supplied?
            if (fileProvided)
            {
                // Override the model defs from assembly with ones supplied in configuration file.
                var modelDefsFromFile = LoadFromFile(filePath);
                if (modelDefsFromFile != null && modelDefsFromFile.Count > 0)
                    foreach (var modelDef in modelDefsFromFile)
                        models[modelDef.Name] = modelDef;
            }

            // Now get all models from map as a list.
            var all = new List<ModelSettings>();
            foreach (DictionaryEntry pair in models) all.Add(pair.Value as ModelSettings);

            return all;
        }
开发者ID:jespinoza711,项目名称:ASP.NET-MVC-CMS,代码行数:44,代码来源:ModelHelper.cs

示例8: CreateCategoryNamePropertyListMap

 private void CreateCategoryNamePropertyListMap()
 {
     this.evaluatedCategories = new List<Category>();
     if (this.Categories != null)
     {
         this.evaluatedCategories.AddRange(this.Categories);
     }
     this.categoryNamePropertyListMap = new OrderedDictionary();
     foreach (Category category in this.Categories)
     {
         this.categoryNamePropertyListMap.Add(category.Name, new List<BaseProperty>());
     }
     foreach (BaseProperty property in this.Properties)
     {
         if (!this.categoryNamePropertyListMap.Contains(property.Category))
         {
             Category item = new Category {
                 Name = property.Category
             };
             this.evaluatedCategories.Add(item);
             this.categoryNamePropertyListMap.Add(item.Name, new List<BaseProperty>());
         }
         (this.categoryNamePropertyListMap[property.Category] as List<BaseProperty>).Add(property);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:Rule.cs

示例9: 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

示例10: RemoveDepartmentButton_Click

        /// <summary>
        /// Remove the user being chosen
        /// by the user drop down list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RemoveDepartmentButton_Click(object sender, EventArgs e)
        {
            HalonModels.Department[] removeList = new HalonModels.Department[DeptList.Rows.Count];

            for (int i = 0; i < DeptList.Rows.Count; i++)
            {
                IOrderedDictionary rowValues = new OrderedDictionary();
                rowValues = GetValues(DeptList.Rows[i]);
                int tempID = Convert.ToInt32(rowValues["Dept_ID"]);

                CheckBox cbRemove = new CheckBox();
                cbRemove = (CheckBox)DeptList.Rows[i].FindControl("RemoveDept");
                if (cbRemove.Checked)
                {
                    var myItem = (from c in db.Departments where c.Dept_ID == tempID select c).FirstOrDefault();
                    if (myItem != null)
                    {
                        //Remove all related items to this department first

                        //then remove the department
                        db.Departments.Remove(myItem);
                        db.SaveChanges();

                        // Reload the page.
                        string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count());
                        Response.Redirect(pageUrl + "?DepartmentAction=remove");
                    }
                    else
                    {
                        LabelRemoveStatus.Text = "Unable to locate Department.";
                    }
                }
            }
        }
开发者ID:jnicholson,项目名称:Firefighter-Training,代码行数:40,代码来源:Dept_Display.aspx.cs

示例11: 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

示例12: 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

示例13: XmlDocumentViewSchema

 public XmlDocumentViewSchema(string name, Pair data, bool includeSpecialSchema)
 {
     this._includeSpecialSchema = includeSpecialSchema;
     this._children = (OrderedDictionary) data.First;
     this._attrs = (ArrayList) data.Second;
     this._name = name;
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:7,代码来源:XmlDocumentViewSchema.cs

示例14: Index

 public ActionResult Index()
 {
     Member _member = new Member("users");
     Hashtable user = _member.getBySession();
     Permission _permission = new Permission(Convert.ToInt32(user["type_id"]));
     string[] permission = _permission.get();
     OrderedDictionary application = new OrderedDictionary();
     if(permission.Length > 0)
     {
         ArrayList apps = this.getApplication();
         if(apps.Count > 0)
         {
             foreach (Hashtable item in apps)
             {
                 if (permission.Contains(item["id"]))
                 {
                     application["app" + item["id"]] = new Hashtable() {
                         {"name",            item["title"]},
                         {"setting",         "/desktop/application/" + item["id"]},
                         {"path",            "/"},
                         {"showOnDesktop",    true}
                     };
                 }
             }
         }
     }
     ViewBag.application = application;
     return View();
 }
开发者ID:ferrywlto,项目名称:Rec-System,代码行数:29,代码来源:DesktopController.cs

示例15: SwcHeaderStore

        public SwcHeaderStore()
        {
            tables = new OrderedDictionary();

            tables["ORIGINAL_SOURCE"] = "SIGEN";
            tables["CREATURE"] = "";
            tables["REGION"] = "";
            tables["FIELD/LAYER"] = "";
            tables["TYPE"] = "";
            tables["CONTRIBUTOR"] = "";
            tables["REFERENCE"] = "";
            tables["RAW"] = "";
            tables["EXTRAS"] = "";
            tables["SOMA_AREA"] = "";
            tables["SHINKAGE_CORRECTION"] = "";
            tables["VERSION_NUMBER"] = "";
            tables["VERSION_DATE"] = "";
            tables["SCALE"] = "";
            tables["INTERPOLATION"] = "";
            tables["DISTANCE_THRESHOLD"] = "";
            tables["VOLUME_THRESHOLD"] = "";
            tables["SMOOTHING"] = "";
            tables["CLIPPING"] = "";
            tables["ROOT_SETTING"] = "NO";
        }
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:25,代码来源:SwcHeaderStore.cs


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