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


C# StringCollection.Contains方法代码示例

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


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

示例1: AddAssemblyReference

 private static void AddAssemblyReference(Assembly referencedAssembly, StringCollection referencedAssemblies)
 {
     string path = Path.GetFullPath(referencedAssembly.Location);
     string name = Path.GetFileName(path);
     if (!(referencedAssemblies.Contains(name) || referencedAssemblies.Contains(path)))
     {
         referencedAssemblies.Add(path);
     }
 }
开发者ID:QuickOrBeDead,项目名称:Dynamic-Wcf-Client-Proxy,代码行数:9,代码来源:ServiceClientProxyCompiler.cs

示例2: GetLinksFromHTML

        public static StringCollection GetLinksFromHTML(string HtmlContent)
        {
            StringCollection links = new StringCollection();

            MatchCollection AnchorTags = Regex.Matches(HtmlContent.ToLower(), @"(<a.*?>.*?</a>)", RegexOptions.Singleline);
            MatchCollection ImageTags = Regex.Matches(HtmlContent.ToLower(), @"(<img.*?>)", RegexOptions.Singleline);

            foreach (Match AnchorTag in AnchorTags)
            {
                string value = AnchorTag.Groups[1].Value;

                Match HrefAttribute = Regex.Match(value, @"href=\""(.*?)\""",
                    RegexOptions.Singleline);
                if (HrefAttribute.Success)
                {
                    string HrefValue = HrefAttribute.Groups[1].Value;
                    HrefValue = HrefValue.Replace(@"\0026", "&");
                    var ascii = Regex.Match(HrefValue, @"&#1?\d\d;", RegexOptions.Singleline);
                    if (ascii.Success)
                    {
                        string chr = ascii.Groups[0].ToString().Remove(0, 2);
                        chr = chr.Remove(chr.Length-1);
                        int ichr = int.Parse(chr);
                        char decodedChar = (char)ichr;
                        HrefValue = HrefValue.Replace(ascii.Groups[0].ToString(), decodedChar.ToString());
                    }
                    HrefValue = HrefValue.Replace("&#58;", ":");
                    if (!links.Contains(HrefValue))
                    {
                        links.Add(HrefValue);
                    }
                }
            }

            foreach (Match ImageTag in ImageTags)
            {
                string value = ImageTag.Groups[1].Value;

                Match SrcAttribute = Regex.Match(value, @"src=\""(.*?)\""",
                    RegexOptions.Singleline);
                if (SrcAttribute .Success)
                {
                    string SrcValue = SrcAttribute.Groups[1].Value;
                    if (!links.Contains(SrcValue))
                    {
                        links.Add(SrcValue);
                    }
                }
            }

            return links;
        }
开发者ID:zenaidura,项目名称:IntegrityCheck,代码行数:52,代码来源:LinkCheckerUtilities.cs

示例3: Test_04_GetUserRoles

		[Test] public void Test_04_GetUserRoles()
		{
            Proxy.AdminRef.Admin admin = new Proxy.AdminRef.Admin( );
			admin.Url = Globals.AdminUrl();
			admin.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");

			string[] roles = admin.GetUserRoles(Globals.SiteCollectionForCreationTests(), @"WSDEV\lnpair");
			Assert.IsTrue(roles.Length == 2, "The user is both a Reader and a Contributor");
			StringCollection roleList = new StringCollection();
			roleList.AddRange(roles);
			Assert.IsTrue(roleList.Contains("Read"), @"WSDEV\lnpair is a Reader on this site.  Really!");
			Assert.IsTrue(roleList.Contains("Contribute"), @"WSDEV\lnpair is a Contributor on this site.  Really!");
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:13,代码来源:TestAdmin.cs

示例4: Test_03_ListUsers

		[Test] public void Test_03_ListUsers()
		{
            Proxy.AdminRef.Admin admin = new Proxy.AdminRef.Admin( );
			admin.Url = Globals.AdminUrl();
			admin.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");

			string[] users = admin.ListUsers(Globals.SiteCollectionForCreationTests());
			Assert.IsTrue(users.Length == 2, "There are two users in the list.");
			StringCollection userList = new StringCollection();
			for(int i = 0; i < users.Length; ++i)
			{
				userList.Add(users[i]);
			}
			Assert.IsTrue(userList.Contains(@"WSDEV\lnpair"), "Contributor user is missing.");
			Assert.IsTrue(userList.Contains(@"UK\iainb"), "Contributor user is missing.");
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:16,代码来源:TestAdmin.cs

示例5: Copy

 public static void Copy(StringCollection frList, StringCollection toList)
 {
     if (frList == null) return;
     for (int idx = 0; idx < frList.Count; idx++)
     {
         if (toList.Contains(frList[idx]) == false) toList.Add(frList[idx]);
     }
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:8,代码来源:stringLibs.cs

示例6: EvaluatePath

    /// <summary>
    /// Evaulate the path string in relation to the current item
    /// </summary>
    /// <param name="context">The Revolver context to evaluate the path against</param>
    /// <param name="path">The path to evaulate. Can either be absolute or relative</param>
    /// <returns>The full sitecore path to the target item</returns>
    public static string EvaluatePath(Context context, string path)
    {
      if (ID.IsID(path))
        return path;

      string workingPath = string.Empty;
      if (!path.StartsWith("/"))
        workingPath = context.CurrentItem.Paths.FullPath + "/" + path;
      else
        workingPath = path;

      // Strip any language and version tags
      if (workingPath.IndexOf(':') >= 0)
        workingPath = workingPath.Substring(0, workingPath.IndexOf(':'));

      // Make relative paths absolute
      string[] parts = workingPath.Split('/');
      StringCollection targetParts = new StringCollection();
      targetParts.AddRange(parts);

      while (targetParts.Contains(".."))
      {
        int ind = targetParts.IndexOf("..");
        targetParts.RemoveAt(ind);
        if (ind > 0)
        {
          targetParts.RemoveAt(ind - 1);
        }
      }

      if (targetParts[targetParts.Count - 1] == ".")
        targetParts.RemoveAt(targetParts.Count - 1);

      // Remove empty elements
      while (targetParts.Contains(""))
      {
        targetParts.RemoveAt(targetParts.IndexOf(""));
      }

      string[] toRet = new string[targetParts.Count];
      targetParts.CopyTo(toRet, 0);
      return "/" + string.Join("/", toRet);
    }
开发者ID:KerwinMa,项目名称:revolver,代码行数:49,代码来源:PathParser.cs

示例7: Clone

 public static StringCollection Clone(StringCollection list)
 {
     if (list == null) return null;
     StringCollection retList = new StringCollection();
     for (int idx = 0; idx < list.Count; idx++)
     {
         if (retList.Contains(list[idx]) == false) retList.Add(list[idx]);
     }
     return retList;
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:10,代码来源:stringLibs.cs

示例8: Convert

		private static TheBox.Data.Facet Convert( LocationsList list )
		{
			TheBox.Data.Facet f = new TheBox.Data.Facet();

			StringCollection categories = new StringCollection();

			foreach( Location loc in list.Places )
			{
				if ( ! categories.Contains( loc.Category ) )
				{
					categories.Add( loc.Category );
				}
			}

			foreach( string cat in categories )
			{
				TheBox.Common.GenericNode g = new TheBox.Common.GenericNode( cat );
				f.Nodes.Add( g );
			}

			foreach( TheBox.Common.GenericNode g in f.Nodes )
			{
				StringCollection sub = new StringCollection();

				foreach( Location loc in list.Places )
				{
					if ( loc.Category == g.Name && ! sub.Contains( loc.Subsection ) )
					{
						sub.Add( loc.Subsection );
					}
				}

				foreach( string s in sub )
				{
					TheBox.Common.GenericNode gSub = new TheBox.Common.GenericNode( s );
					g.Elements.Add( gSub );
				}
			}

			foreach( TheBox.Common.GenericNode gCat in f.Nodes )
			{
				foreach( TheBox.Common.GenericNode gSub in gCat.Elements )
				{
					foreach( Location loc in list.Places )
					{
						if ( loc.Category == gCat.Name && loc.Subsection == gSub.Name )
						{
							gSub.Elements.Add( Convert( loc ) );
						}
					}
				}
			}

			return f;
		}
开发者ID:aj9251,项目名称:pandorasbox3,代码行数:55,代码来源:PB1Import.cs

示例9: CompareColumns

 private static bool CompareColumns(DataTable source, DataRow sourcerow, DataRow destrow, StringCollection ignorecolumns)
 {
     foreach(DataColumn column in source.Columns) {
         // Not in ignored columns?
         if(ignorecolumns == null || !ignorecolumns.Contains(column.ColumnName)) {
             if(sourcerow[column.ColumnName].ToString() != destrow[column.ColumnName].ToString())
                 return false;
         }
     }
     return true;		// All columns matching
 }
开发者ID:pontusm,项目名称:Deployer,代码行数:11,代码来源:DataTableComparer.cs

示例10: HasHorizontalVisibility

        public bool HasHorizontalVisibility(StringCollection activeAgentFacets)
        {
            char[] lDelimiter = { ',' };
            string[] lAgents = EmptyHorizontalVisibility.Split(lDelimiter);

            for (int i = 0; i < lAgents.Length; i++)
            {
                if (activeAgentFacets.Contains(lAgents[i].Trim()))
                    return false;
            }

            lAgents = HorizontalVisibility.Split(lDelimiter);
            for (int i = 0; i < lAgents.Length; i++)
            {
                if (activeAgentFacets.Contains(lAgents[i].Trim()))
                    return true;
            }

            return false;
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:20,代码来源:ONRoleAttribute.cs

示例11: GetDepartmentCostCentre

        private static ACostCentreRow GetDepartmentCostCentre(ACostCentreTable ACostCentres,
            ACostCentreRow ACostCentreToInvestigate,
            StringCollection ADepartmentCodes)
        {
            if (ADepartmentCodes.Contains(ACostCentreToInvestigate.CostCentreCode))
            {
                return ACostCentreToInvestigate;
            }

            ACostCentreRow row = (ACostCentreRow)ACostCentres.DefaultView.FindRows(ACostCentreToInvestigate.CostCentreToReportTo)[0].Row;

            return GetDepartmentCostCentre(ACostCentres, row, ADepartmentCodes);
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:13,代码来源:accounts.cs

示例12: AddAssemblyToStringCollection

 internal static void AddAssemblyToStringCollection(Assembly assembly, StringCollection toList)
 {
     string path = null;
     if (!MultiTargetingUtil.EnableReferenceAssemblyResolution)
     {
         path = GetAssemblyCodeBase(assembly);
     }
     else if (AssemblyResolver.GetPathToReferenceAssembly(assembly, out path) == ReferenceAssemblyType.FrameworkAssemblyOnlyPresentInHigherVersion)
     {
         return;
     }
     if (!toList.Contains(path))
     {
         toList.Add(path);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:Util.cs

示例13: Test_01_ListAvailableSiteTemplates

		[Test] public void Test_01_ListAvailableSiteTemplates()
		{
            Proxy.AdminRef.Admin admin = new Proxy.AdminRef.Admin( );
			admin.Url = Globals.AdminUrl();
			admin.Credentials = System.Net.CredentialCache.DefaultCredentials.GetCredential(new Uri(Globals.SharePointTestServer), "");

			string[] templates = admin.ListAvailableSiteTemplates(Globals.SiteCollectionForTests());
			StringCollection tpls = new StringCollection();
			tpls.AddRange(templates);
			Assert.IsTrue(tpls.Contains("Team Site"), "Template is missing: Team Site");
			Assert.IsTrue(tpls.Contains("Blank Site"), "Template is missing: Blank Site");
			Assert.IsTrue(tpls.Contains("Document Workspace"), "Template is missing: Document Workspace");
			Assert.IsTrue(tpls.Contains("Basic Meeting Workspace"), "Template is missing: Basic Meeting Workspace");
			Assert.IsTrue(tpls.Contains("Blank Meeting Workspace"), "Template is missing: Blank Meeting Workspace");
			Assert.IsTrue(tpls.Contains("Decision Meeting Workspace"), "Template is missing: Decision Meeting Workspace");
			Assert.IsTrue(tpls.Contains("Social Meeting Workspace"), "Template is missing: Social Meeting Workspace");
			Assert.IsTrue(tpls.Contains("Multipage Meeting Workspace"), "Template is missing: Multipage Meeting Workspace");
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:18,代码来源:TestAdmin.cs

示例14: LoadPingServices

        // Loads the ping services into a StringCollection
        public override StringCollection LoadPingServices()
        {
            string fileName = _Folder + "PingServices.xml";
              if (!File.Exists(fileName))
            return new StringCollection();

              StringCollection col = new StringCollection();
              XmlDocument doc = new XmlDocument();
              doc.Load(fileName);

              foreach (XmlNode node in doc.SelectNodes("services/service"))
              {
            if (!col.Contains(node.InnerText))
              col.Add(node.InnerText);
              }
              return col;
        }
开发者ID:chandru9279,项目名称:StarBase,代码行数:18,代码来源:PingServices.cs

示例15: DisabledKey

        /// <summary>
        /// The disabled key.
        /// </summary>
        /// <param name="disabledKey">
        /// The the key that will be used to maanage the disabled field.
        /// </param>
        /// <param name="fieldName">
        /// The field name.
        /// </param>
        public void DisabledKey(string disabledKey, string fieldName)
        {
            var currentDisabledKeys = new StringCollection();

            if (this.disabledKeys.ContainsKey(fieldName))
            {
                currentDisabledKeys = this.disabledKeys[fieldName] as StringCollection;
                this.disabledKeys.Remove(fieldName);
            }

            if (currentDisabledKeys != null && !currentDisabledKeys.Contains(disabledKey))
            {
                currentDisabledKeys.Add(disabledKey);
            }

            this.disabledKeys.Add(fieldName, currentDisabledKeys);
        }
开发者ID:kendrewp,项目名称:SBXAThemeSupport,代码行数:26,代码来源:UiViewModel.cs


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