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


C# HybridDictionary.Contains方法代码示例

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


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

示例1: All

		public void All ()
		{
			HybridDictionary dict = new HybridDictionary (true);
			dict.Add ("CCC", "ccc");
			dict.Add ("BBB", "bbb");
			dict.Add ("fff", "fff");
			dict ["EEE"] = "eee";
			dict ["ddd"] = "ddd";
			
			Assert.AreEqual (5, dict.Count, "#1");
			Assert.AreEqual ("eee", dict["eee"], "#2");
			
			dict.Add ("CCC2", "ccc");
			dict.Add ("BBB2", "bbb");
			dict.Add ("fff2", "fff");
			dict ["EEE2"] = "eee";
			dict ["ddd2"] = "ddd";
			dict ["xxx"] = "xxx";
			dict ["yyy"] = "yyy";

			Assert.AreEqual (12, dict.Count, "#3");
			Assert.AreEqual ("eee", dict["eee"], "#4");

			dict.Remove ("eee");
			Assert.AreEqual (11, dict.Count, "Removed/Count");
			Assert.IsFalse (dict.Contains ("eee"), "Removed/Contains(xxx)");
			DictionaryEntry[] entries = new DictionaryEntry [11];
			dict.CopyTo (entries, 0);

			Assert.IsTrue (dict.Contains ("xxx"), "Contains(xxx)");
			dict.Clear ();
			Assert.AreEqual (0, dict.Count, "Cleared/Count");
			Assert.IsFalse (dict.Contains ("xxx"), "Cleared/Contains(xxx)");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:34,代码来源:HybridDictionaryTest.cs

示例2: Empty

		public void Empty () 
		{
			HybridDictionary hd = new HybridDictionary ();
			Assert.AreEqual (0, hd.Count, "Count");
			Assert.IsFalse (hd.Contains ("unexisting"), "unexisting");
			// under 1.x no exception, under 2.0 ArgumentNullException
			Assert.IsFalse (hd.Contains (null), "Contains(null)");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:HybridDictionaryTest.cs

示例3: Arguments

		// Constructor
		public Arguments(string[] Args){
			//Parameters=new StringDictionary();
			Parameters=new HybridDictionary();
			Regex Spliter=new Regex(@"^-{1,2}|^/|=|:", RegexOptions.IgnoreCase|RegexOptions.Compiled);
			Regex Remover= new Regex(@"^['""]?(.*?)['""]?$", RegexOptions.IgnoreCase|RegexOptions.Compiled);
			string Parameter=null;
			string[] Parts;

			// Valid parameters forms:
			// {-,/,--}param{ ,=,:}((",')value(",'))
			// Examples: -param1 value1 --param2 /param3:"Test-:-work" /param4=happy -param5 '--=nice=--'
			foreach(string Txt in Args){
				// Look for new parameters (-,/ or --) and a possible enclosed value (=,:)
				Parts=Spliter.Split(Txt,3);
				switch(Parts.Length){
					// Found a value (for the last parameter found (space separator))
					case 1:
						if(Parameter!=null){
							if(!Parameters.Contains(Parameter)){
								Parts[0]=Remover.Replace(Parts[0],"$1");
								Parameters.Add(Parameter,Parts[0]);
								}
							Parameter=null;
							}
						// else Error: no parameter waiting for a value (skipped)
						break;
					// Found just a parameter
					case 2:
						// The last parameter is still waiting. With no value, set it to true.
						if(Parameter!=null){
							if(!Parameters.Contains(Parameter)) Parameters.Add(Parameter,"true");
							}
						Parameter=Parts[1];
						break;
					// Parameter with enclosed value
					case 3:
						// The last parameter is still waiting. With no value, set it to true.
						if(Parameter!=null){
							if(!Parameters.Contains(Parameter)) Parameters.Add(Parameter,"true");
							}
						Parameter=Parts[1];
						// Remove possible enclosing characters (",')
						if(!Parameters.Contains(Parameter)){
							Parts[2]=Remover.Replace(Parts[2],"$1");
							Parameters.Add(Parameter,Parts[2]);
							}
						Parameter=null;
						break;
					}
				}
			// In case a parameter is still waiting
			if(Parameter!=null){
				if(!Parameters.Contains(Parameter)) Parameters.Add(Parameter,"true");
				}
			}
开发者ID:kodenine,项目名称:SubWriter,代码行数:56,代码来源:Arguments.cs

示例4: WebPartDescriptionCollection

        public WebPartDescriptionCollection(ICollection webPartDescriptions) {
            if (webPartDescriptions == null) {
                throw new ArgumentNullException("webPartDescriptions");
            }

            _ids = new HybridDictionary(webPartDescriptions.Count, true /* caseInsensitive */);
            foreach (object obj in webPartDescriptions) {
                if (obj == null) {
                    throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "webPartDescriptions");
                }
                WebPartDescription description = obj as WebPartDescription;
                if (description == null) {
                    throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "WebPartDescription"),
                                                "webPartDescriptions");
                }
                string id = description.ID;
                if (!_ids.Contains(id)) {
                    InnerList.Add(description);
                    _ids.Add(id, description);
                }
                else {
                    throw new ArgumentException(SR.GetString(SR.WebPart_Collection_DuplicateID, "WebPartDescription", id), "webPartDescriptions");
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:WebPartDescriptionCollection.cs

示例5: AnalyzeEnum

		private void AnalyzeEnum( Type enumType )
		{
			_enumName = enumType.Name;

			R.FieldInfo[] fieldInfos = enumType.GetFields( BindingFlags.Static | BindingFlags.Public );

			_namedValues = new HybridDictionary( fieldInfos.Length, false );
			_valuedNames = new HybridDictionary( fieldInfos.Length, false );

			foreach( R.FieldInfo fi in fieldInfos )
			{
				if( ( fi.Attributes & EnumField ) == EnumField )
				{
					string name = fi.Name;
					object value = fi.GetValue( null );

					Attribute[] attrs =
						Attribute.GetCustomAttributes( fi, typeof( XmlEnumAttribute ) );
					if( attrs.Length > 0 )
					{
						XmlEnumAttribute attr = (XmlEnumAttribute)attrs[0];
						name = attr.Name;
					}

					_namedValues.Add( name, value );
					if( !_valuedNames.Contains( value ))
						_valuedNames.Add( value, name );
				}
			}
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:30,代码来源:EnumConverter.cs

示例6: NotEmpty

		public void NotEmpty () 
		{
			HybridDictionary hd = new HybridDictionary (true);
			hd.Add ("CCC", "ccc");
			AssertEquals ("Count", 1, hd.Count);
			Assert ("null", !hd.Contains (null));
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:HybridDictionaryTest.cs

示例7: ConsumerConnectionPointCollection

        public ConsumerConnectionPointCollection(ICollection connectionPoints) {
            if (connectionPoints == null) {
                throw new ArgumentNullException("connectionPoints");
            }

            _ids = new HybridDictionary(connectionPoints.Count, true /* caseInsensitive */);
            foreach (object obj in connectionPoints) {
                if (obj == null) {
                    throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "connectionPoints");
                }
                ConsumerConnectionPoint point = obj as ConsumerConnectionPoint;
                if (point == null) {
                    throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "ConsumerConnectionPoint"),
                                                "connectionPoints");
                }
                string id = point.ID;
                if (!_ids.Contains(id)) {
                    InnerList.Add(point);
                    _ids.Add(id, point);
                }
                else {
                    throw new ArgumentException(SR.GetString(SR.WebPart_Collection_DuplicateID, "ConsumerConnectionPoint", id), "connectionPoints");
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:ConsumerConnectionPointCollection.cs

示例8: BadgeComponent

 /// <summary>
 /// Initializes a new instance of the <see cref="BadgeComponent"/> class.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <param name="data">The data.</param>
 internal BadgeComponent(uint userId, UserData data)
 {
     BadgeList = new HybridDictionary();
     foreach (var current in data.Badges.Where(current => !BadgeList.Contains(current.Code)))
         BadgeList.Add(current.Code, current);
     _userId = userId;
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:12,代码来源:BadgeComponent.cs

示例9: LookupMember

 private void LookupMember(string name, HybridDictionary visitedAliases, out PSMemberInfo returnedMember, out bool hasCycle)
 {
     returnedMember = null;
     if (base.instance == null)
     {
         throw new ExtendedTypeSystemException("AliasLookupMemberOutsidePSObject", null, ExtendedTypeSystem.AccessMemberOutsidePSObject, new object[] { name });
     }
     PSMemberInfo info = PSObject.AsPSObject(base.instance).Properties[name];
     if (info == null)
     {
         throw new ExtendedTypeSystemException("AliasLookupMemberNotPresent", null, ExtendedTypeSystem.MemberNotPresent, new object[] { name });
     }
     PSAliasProperty property = info as PSAliasProperty;
     if (property == null)
     {
         hasCycle = false;
         returnedMember = info;
     }
     else if (visitedAliases.Contains(name))
     {
         hasCycle = true;
     }
     else
     {
         visitedAliases.Add(name, name);
         this.LookupMember(property.ReferencedMemberName, visitedAliases, out returnedMember, out hasCycle);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:28,代码来源:PSAliasProperty.cs

示例10: GetCollectionDelta

 private ICollection GetCollectionDelta(ICollection original, ICollection modified)
 {
     if (((original != null) && (modified != null)) && (original.Count != 0))
     {
         IEnumerator enumerator = modified.GetEnumerator();
         if (enumerator != null)
         {
             IDictionary dictionary = new HybridDictionary();
             foreach (object obj2 in original)
             {
                 if (dictionary.Contains(obj2))
                 {
                     int num = (int) dictionary[obj2];
                     dictionary[obj2] = ++num;
                 }
                 else
                 {
                     dictionary.Add(obj2, 1);
                 }
             }
             ArrayList list = null;
             for (int i = 0; (i < modified.Count) && enumerator.MoveNext(); i++)
             {
                 object current = enumerator.Current;
                 if (dictionary.Contains(current))
                 {
                     if (list == null)
                     {
                         list = new ArrayList();
                         enumerator.Reset();
                         for (int j = 0; (j < i) && enumerator.MoveNext(); j++)
                         {
                             list.Add(enumerator.Current);
                         }
                         enumerator.MoveNext();
                     }
                     int num4 = (int) dictionary[current];
                     if (--num4 == 0)
                     {
                         dictionary.Remove(current);
                     }
                     else
                     {
                         dictionary[current] = num4;
                     }
                 }
                 else if (list != null)
                 {
                     list.Add(current);
                 }
             }
             if (list != null)
             {
                 return list;
             }
         }
     }
     return modified;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:59,代码来源:CollectionCodeDomSerializer.cs

示例11: UserBadgeManager

        /// <summary>
        ///     Initializes a new instance of the <see cref="UserBadgeManager" /> class.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <param name="data">The data.</param>
        internal UserBadgeManager(uint userId, UserData data)
        {
            BadgeList = new HybridDictionary();

            foreach (Badge current in data.Badges.Where(current => !BadgeList.Contains(current.Code)))
                BadgeList.Add(current.Code, current);

            _userId = userId;
        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:14,代码来源:UserBadgeManager.cs

示例12: InitServers

 public void InitServers(HybridDictionary servers)
 {
     this.cmbServers.Properties.Items.Clear();
     foreach (string str in servers.Keys)
     {
         this.cmbServers.Properties.Items.Add(str);
     }
     string str2 = PropertyService.Get<string>("DefaultServer", string.Empty);
     this.cmbServers.EditValue = (!string.IsNullOrEmpty(str2) && servers.Contains(str2)) ? str2 : this.cmbServers.Properties.Items[0];
     this.chkDefault.Checked = PropertyService.Get<bool>("IsHideServerDialogOnNext", true);
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:11,代码来源:ServerDialog.cs

示例13: GetFontTable

        private static string GetFontTable(Font font)
        {
            var fontTable = new StringBuilder();
            // Append table control string
            fontTable.Append(@"{\fonttbl{\f0");
            fontTable.Append(@"\");
            var rtfFontFamily = new HybridDictionary();
            rtfFontFamily.Add(FontFamily.GenericMonospace.Name, RtfFontFamilyDef.Modern);
            rtfFontFamily.Add(FontFamily.GenericSansSerif, RtfFontFamilyDef.Swiss);
            rtfFontFamily.Add(FontFamily.GenericSerif, RtfFontFamilyDef.Roman);
            rtfFontFamily.Add("UNKNOWN", RtfFontFamilyDef.Unknown);

            // If the font's family corresponds to an RTF family, append the
            // RTF family name, else, append the RTF for unknown font family.
            fontTable.Append(rtfFontFamily.Contains(font.FontFamily.Name) ? rtfFontFamily[font.FontFamily.Name] : rtfFontFamily["UNKNOWN"]);
            // \fcharset specifies the character set of a font in the font table.
            // 0 is for ANSI.
            fontTable.Append(@"\fcharset0 ");
            // Append the name of the font
            fontTable.Append(font.Name);
            // Close control string
            fontTable.Append(@";}}");
            return fontTable.ToString();
        }
开发者ID:AbabeiAndrei,项目名称:WProject,代码行数:24,代码来源:RitchTextBoxEx.cs

示例14: Initialize

        private void Initialize(WebPartVerbCollection existingVerbs, ICollection verbs) {
            int count = ((existingVerbs != null) ? existingVerbs.Count : 0) + ((verbs != null) ? verbs.Count : 0);
            _ids = new HybridDictionary(count, /* caseInsensitive */ true);

            if (existingVerbs != null) {
                foreach (WebPartVerb existingVerb in existingVerbs) {
                    // Don't need to check arg, since we know it is valid since it came
                    // from a CatalogPartCollection.
                    if (_ids.Contains(existingVerb.ID)) {
                        throw new ArgumentException(SR.GetString(SR.WebPart_Collection_DuplicateID, "WebPartVerb", existingVerb.ID), "existingVerbs");
                    }
                    _ids.Add(existingVerb.ID, existingVerb);

                    InnerList.Add(existingVerb);
                }
            }

            if (verbs != null) {
                foreach (object obj in verbs) {
                    if (obj == null) {
                        throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "verbs");
                    }
                    WebPartVerb webPartVerb = obj as WebPartVerb;
                    if (webPartVerb == null) {
                        throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "WebPartVerb"), "verbs");
                    }

                    if (_ids.Contains(webPartVerb.ID)) {
                        throw new ArgumentException(SR.GetString(SR.WebPart_Collection_DuplicateID, "WebPartVerb", webPartVerb.ID), "verbs");
                    }
                    _ids.Add(webPartVerb.ID, webPartVerb);

                    InnerList.Add(webPartVerb);
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:36,代码来源:WebPartVerbCollection.cs

示例15: RemoveFromMap

        /// <summary>
        ///     Removes from map.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="handleGameItem">if set to <c>true</c> [handle game item].</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        internal bool RemoveFromMap(RoomItem item, bool handleGameItem)
        {
            RemoveSpecialItem(item);
            if (_room.GotSoccer())
                _room.GetSoccer().OnGateRemove(item);
            bool result = false;
            foreach (Point current in item.GetCoords.Where(current => RemoveCoordinatedItem(item, current)))
                result = true;
            HybridDictionary hybridDictionary = new HybridDictionary();
            foreach (Point current2 in item.GetCoords)
            {
                int point = CoordinatesFormatter.PointToInt(current2);
                if (CoordinatedItems.Contains(point))
                {
                    List<RoomItem> value = (List<RoomItem>) CoordinatedItems[point];
                    if (!hybridDictionary.Contains(current2))
                        hybridDictionary.Add(current2, value);
                }
                SetDefaultValue(current2.X, current2.Y);
            }
            foreach (Point point2 in hybridDictionary.Keys)
            {
                List<RoomItem> list = (List<RoomItem>) hybridDictionary[point2];
                foreach (RoomItem current3 in list)
                    ConstructMapForItem(current3, point2);
            }
            if (GuildGates.ContainsKey(item.Coordinate))
                GuildGates.Remove(item.Coordinate);
            _room.GetRoomItemHandler().OnHeightMapUpdate(hybridDictionary.Keys);
            hybridDictionary.Clear();

            return result;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:39,代码来源:Gamemap.cs


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