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


C# System.Collections.ObjectModel.Collection.Any方法代码示例

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


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

示例1: RegistryRead

        public Settings RegistryRead (Settings settings)
        {
			var settingsInformation = new List<RegistryEntry>();
			if (App.IsWindowsMachine) settingsInformation = (new Settings()).AsEnumerable(SettingsReturnType.Essential).ReadFromRegistry(registryRootValue, App.IsDebugging).ToList();
			else
			{
				var settingsFromFile = new System.Collections.ObjectModel.Collection<string>().AddFileContents(RegistryFile);
				if(settingsFromFile.Any())
				{
					for (var position = settingsFromFile.GetEnumerator(); position.MoveNext();)
					{
						var entry = position.Current.Split(new[] { RegistryEntry.Separator }, StringSplitOptions.RemoveEmptyEntries);
						settingsInformation.Add(new RegistryEntry(entry.First(), entry.Last()));
					}
				}
			}
			return settings.Replace(settingsInformation);
        }
开发者ID:AnonymousUser200102010,项目名称:Youtube-Download-Helper,代码行数:18,代码来源:Storage.cs

示例2: Execute

        public override void Execute()
        {
            SrcMLFile testFile = new SrcMLFile(this.File);
            XElement firstFile = testFile.FileUnits.First();

            //get all the functions
            var containers = new System.Collections.ObjectModel.Collection<XName>() { SRC.Function, SRC.Constructor, SRC.Destructor };
            var funcs = from func in firstFile.Descendants()
                        where containers.Any(c => c == func.Name)
                        select func;

            Dictionary<XElement, string> functionComments = new Dictionary<XElement, string>();


            //grab the comment block for each function
            foreach (var func in funcs)
            {
                StringBuilder functionComment = new StringBuilder();

                var prevElements = func.ElementsBeforeSelf().Reverse();
                foreach (var element in prevElements)
                {
                    if (element.Name == SRC.Comment)
                    {
                        //add comment to beginning of comment block
                        functionComment.Insert(0, element.Value + System.Environment.NewLine);
                    }
                    else
                    {
                        //found something besides a comment
                        break;
                    }
                }

                functionComments[func] = functionComment.ToString();
            }

            AbbreviationExpander ae = new AbbreviationExpander();
            ae.Expand(Word, functionComments.First().Key, functionComments.First().Value, "");

            //string patternRegex;
            //string shortForm = Word;
            //StringBuilder sb = new StringBuilder(@"\b");
            //for (int i = 0; i < shortForm.Length - 1; i++)
            //{
            //    sb.AppendFormat(@"{0}\w+\s+", shortForm[i]);
            //}
            //sb.AppendFormat(@"{0}\w+\b", shortForm[shortForm.Length - 1]);
            //patternRegex = sb.ToString();

            //Console.WriteLine("Acronym regex: {0}", patternRegex);

            //string methodComment = functionComments.First().Value;
            //Match m = Regex.Match(methodComment, string.Format("({0})", patternRegex), RegexOptions.IgnoreCase);
            //if (m.Success)
            //{
            //    Console.WriteLine("Found match: {0}", m.Groups[1].Value);
            //}
        }
开发者ID:abb-iss,项目名称:Swum.NET,代码行数:59,代码来源:Program.cs


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