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


C# IEnumerable.Join方法代码示例

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


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

示例1: Format

 public string Format(MethodInfo methodInfo, IEnumerable<string> arguments)
 {
     if (methodInfo.DeclaringType == typeof (DelegateCall))
     {
         return string.Format("Invoke({0})", arguments.Join(", "));
     }
     return string.Format("{0}{1}({2})", methodInfo.Name, FormatGenericType(methodInfo), arguments.Join(", "));
 }
开发者ID:deatharthas,项目名称:NSubstitute,代码行数:8,代码来源:MethodFormatter.cs

示例2: ForeignKeyException

 public ForeignKeyException(int referredid, IEnumerable<int> referrerids, string tablename)
     : base(String.Format("The entity with Id={0} is referred to by {1} entities with Id={2} and cannot be deleted.", referredid, tablename, referrerids.Join(", ")))
 {
     ReferredId = referredid;
     ReferrerIds = referrerids.ToList();
     ReferrersType = tablename;
 }
开发者ID:W0dan,项目名称:SamStock,代码行数:7,代码来源:ForeignKeyException.cs

示例3: Run

			/// <summary>Runs a list of CMD commands.</summary>
			/// <param name="commands">List of commands to execute by CMD window.</param>
			/// <returns>The associated process.</returns>
			public static Task<Process> Run(IEnumerable<string> commands)
			{
				var procStartInfo = new ProcessStartInfo
									{
										RedirectStandardError = false,
										RedirectStandardOutput = true,
										UseShellExecute = false,
										FileName = "cmd",
										WindowStyle = ProcessWindowStyle.Hidden,
										CreateNoWindow = true,
										Arguments = "/c " + commands.Join("&"),
									};


				var process = new Process();
				process.EnableRaisingEvents = true;
				process.StartInfo = procStartInfo;
				var tcs = new TaskCompletionSource<Process>();
				process.Exited += (sender, args) => tcs.SetResult(process);
				try
				{
					process.Start();
				}
				catch (Exception e)
				{
					tcs.SetException(e);
				}


				return tcs.Task;
			}
开发者ID:cssack,项目名称:CsGlobals,代码行数:34,代码来源:CMD.cs

示例4: RunElevated

			public static Task<Process> RunElevated(IEnumerable<string> commands)
			{
				var procStartInfo = new ProcessStartInfo()
				{
					RedirectStandardError = false,
					RedirectStandardOutput = false,
					FileName = "cmd",
					Verb = "runas",
					Arguments = "/C " + commands.Join("&"),
				};

				var process = new Process();
				process.EnableRaisingEvents = true;
				process.StartInfo = procStartInfo;
				var tcs = new TaskCompletionSource<Process>();
				process.Exited += (sender, args) => tcs.SetResult(process);
				try
				{
					process.Start();
				}
				catch (Exception e)
				{
					tcs.SetException(e);
				}


				return tcs.Task;
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:28,代码来源:CMD.cs

示例5: DiffRows

        IEnumerable<Result> DiffRows(IEnumerable<Row> rows1, IEnumerable<Row> rows2)
        {
            var rows = rows1.Join(rows2, r => r.Name, r => r.Name, (r1, r2) => new Tuple<Row, Row>(r1, r2));
            var errors = rows.Select(t => DiffRows(t.Item1, t.Item2)).SelectMany(i => i);

            return errors.GroupBy(e => e.Column).Select(g => new Result { Title = g.Key, Errors = g.Select(e => e.Message).Distinct().ToList() });
        }
开发者ID:jperdue,项目名称:cde-export,代码行数:7,代码来源:Differ.cs

示例6: ReadAcceptType

        private string ReadAcceptType(IEnumerable<string> header)
        {
            if (header == null || header.Count() == 0) return "*/*";

            if (header.Count() == 1) return header.Single();

            return header.Join(", ");
        }
开发者ID:NeilSorensen,项目名称:fubumvc,代码行数:8,代码来源:CurrentMimeTypeModelBinder.cs

示例7: NounNotFound

 public NounNotFound(IEnumerable<string> nouns)
 {
     nouns = nouns.ToList();
     if (nouns.Count() == 0)
         _message = "Noun not found.";
     else
         _message = "Ambiguous noun. Possible matches: " + nouns.Join(", ");
 }
开发者ID:andrewdavey,项目名称:openwrap,代码行数:8,代码来源:NounNotFound.cs

示例8: validateMatchingMimetypes

 private static void validateMatchingMimetypes(MimeType mimeType, AssetTagPlan plan, IEnumerable<string> names)
 {
     if (plan.Subjects.Any(x => x.MimeType != mimeType))
     {
         var message = "Files {0} have mixed mimetype's".ToFormat(names.Join(", "));
         throw new MixedMimetypeException(message);
     }
 }
开发者ID:bobpace,项目名称:FubuMVC.Core.Assets,代码行数:8,代码来源:AssetTagPlanner.cs

示例9: MapScope

 public static IEnumerable<string> MapScope(IEnumerable<ReferenceDataItem> collection, IEnumerable<string> config)
 {
     return collection.Join(
         config,
         s => s.Name,
         r => r,
         (s, r) => s.Id,
         StringComparer.OrdinalIgnoreCase);
 }
开发者ID:Pondidum,项目名称:OctopusStore,代码行数:9,代码来源:VariableFilter.cs

示例10: TestSuite

 public TestSuite(IEnumerable<ITestee> parsers, IEnumerable<ITest> tests, IOutput output, IWarmup warmup = null)
 {
     _reruns = 1;
     _repeats = 10;
     _parsers = parsers;
     _tests = tests;
     _output = output;
     _warmup = warmup;
     _results = new List<TestResult>(parsers.Join(tests, m => 0, m => 0, (a, b) => new TestResult(b, a)));
 }
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:10,代码来源:TestSuite.cs

示例11: BuildDefaultName

        /// <summary>
        ///     Creates a default index name based on the supplied column names.
        /// </summary>
        /// <param name="columns">The column names used to create a default index name.</param>
        /// <returns>A default index name.</returns>
        public static string BuildDefaultName(IEnumerable<string> columns)
        {
            Check.NotNull(columns, "columns");

            return string.Format(
                CultureInfo.InvariantCulture,
                "IX_{0}",
                columns.Join(separator: "_"))
                .RestrictTo(128);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:15,代码来源:IndexOperation.cs

示例12: DictionaryPath

        public DictionaryPath(string path)
        {
            var parts = path.Trim().Split('.');
            _parentParts = parts.Reverse().Skip(1).Reverse();
            _parent = parts.Any()
                          ? _parentParts.Join(".")
                          : String.Empty;

            _key = parts.Last();
        }
开发者ID:nieve,项目名称:FubuRESTInnovation,代码行数:10,代码来源:DictionaryPath.cs

示例13: AssetNamesKey

        public AssetNamesKey(IEnumerable<string> names)
        {
            _names = names.OrderBy(x => x);

            _hashcode = new Lazy<int>(() =>
            {
                var combined = names.Join("*");
                return combined.ToHash().GetHashCode();
            });
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:10,代码来源:AssetNamesKey.cs

示例14: CheckMetadataStringOperator

        private IEnumerable<Node> CheckMetadataStringOperator(MappingToolDatabaseDataContext dbContext, IEnumerable<Node> nodes, GraphQueryMetadata metadataTest)
        {
            List<Node> filteredNodes = null;

            if (metadataTest.Operator.Equals("Contains", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable<Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata = from dbMetadata in dbContext.udf_SearchMetadataContains(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else if (metadataTest.Operator.Equals("FreeText", StringComparison.InvariantCultureIgnoreCase))
            {
                IQueryable<Node> queryableNodes = nodes.AsQueryable();
                var filteredMetadata = from dbMetadata in dbContext.udf_SearchMetadataFreeText(metadataTest.Name, metadataTest.Value) select dbMetadata;
                int counter = filteredMetadata.Count();
                filteredNodes = nodes.Join(filteredMetadata, x => x.NodeUid, y => y.NodeUid, (a, b) => a).ToList();
            }
            else
            {
                filteredNodes = new List<Node>();

                foreach (Node node in nodes)
                {
                    if (metadataTest.Operator.Equals("Equals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue.Contains(metadataTest.Value)).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                    else if (metadataTest.Operator.Equals("NotEquals", StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (node.Metadatas.Where(metadata => metadata.MetadataName == metadataTest.Name && metadata.MetadataValue != metadataTest.Value).Count() > 0)
                        {
                            filteredNodes.Add(node);
                        }
                    }
                }
            }

            return filteredNodes;
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:43,代码来源:GraphQueryFilter_Class.cs

示例15: SetUniqueNamesForForeignKeyProperties

        public static void SetUniqueNamesForForeignKeyProperties(IEnumerable<ForeignKey> foreignKeys)
        {
            IEnumerable<string> refsUsedMoreThanOnce = foreignKeys.Select(f => f.References).Distinct()
                .GroupJoin(foreignKeys, a => a, b => b.References, (a, b) => new { References = a, Count = b.Count() })
                .Where(@t => t.Count > 1)
                .Select(@t => t.References);

            foreignKeys.Join(refsUsedMoreThanOnce, a => a.References, b => b, (a, b) => a).ToList()
                .ForEach(fk => { fk.UniquePropertyName = fk.Name + "_" + fk.References; });
        }
开发者ID:vipinsinghal,项目名称:SqlDbExtractor,代码行数:10,代码来源:SqlTable.cs


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