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


C# IDictionary.All方法代码示例

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


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

示例1: AddForeignsDelete

        private void AddForeignsDelete(
            DbCommand cmd,
            Entity entity,
            IDictionary<string, DeleteOption> options)
        {
            if (options.All(x => x.Value == DeleteOption.Nothing || x.Value == DeleteOption.AskUser))
                return;

            var sbDeletes = new StringBuilder();
            var recordHierarchy = _hierarchySource.GetRecordHierarchy(entity);
            foreach (var subRecord in recordHierarchy.SubRecordsHierarchies)
            {
                var deleteOption = DeleteOption.Nothing;
                if (options.ContainsKey(subRecord.Entity.Name))
                {
                    deleteOption = options[subRecord.Entity.Name];
                }
                switch (deleteOption)
                {
                    case DeleteOption.SetNull:
                        sbDeletes.AppendLine(GetSetToNullUpdateSql(cmd, entity, subRecord));
                        break;
                    case DeleteOption.CascadeDelete:
                        var deletes = GetDeleteRelatedEntityDeleteSql(cmd, subRecord).Reverse();
                        sbDeletes.AppendLine(string.Join(Environment.NewLine, deletes));
                        break;
                }
            }
            cmd.CommandText = sbDeletes + cmd.CommandText;
        }
开发者ID:Anupam-,项目名称:Ilaro.Admin,代码行数:30,代码来源:RecordsDeleter.cs

示例2: ContainsAllTags

 public static bool ContainsAllTags(ObjectivesResultsCollection x, IDictionary<string, string> tags)
 {
     var xTags = x.Tags.Tags;
     return tags.All((dictTag =>
         (xTags.Any((xTag =>
             (dictTag.Key == xTag.Name && dictTag.Value == xTag.Value))))));
 }
开发者ID:jmp75,项目名称:metaheuristics,代码行数:7,代码来源:DbContextOperations.cs

示例3: ConditionsMet

 public bool ConditionsMet(IDictionary<string, bool> playerState, IDictionary<string, bool> conditions)
 {
     return
         conditions.All(
             c =>
                 (!c.Value && (!playerState.ContainsKey(c.Key) || !playerState[c.Key])) ||
                 (c.Value && (playerState.ContainsKey(c.Key) && playerState[c.Key])));
 }
开发者ID:rudism,项目名称:Ficdown,代码行数:8,代码来源:Utilities.cs

示例4: GetUniqueName

        public static string GetUniqueName(IDictionary<string, ApiObject> objects, string name, IDictionary<string, ApiObject> otherObjects, IDictionary<string, ApiObject> schemaObjects)
        {
            for (var i = 0; i < 100; i++)
            {
                var unique = name + i;
                if (schemaObjects.All(p => p.Value.Name != unique) && objects.All(p => p.Value.Name != unique) && otherObjects.All(p => p.Value.Name != unique))
                    return unique;
            }

            foreach (var suffix in Suffixes)
            {
                for (var i = 0; i < 100; i++)
                {
                    var unique = name + suffix + i;
                    if (schemaObjects.All(p => p.Value.Name != unique) && objects.All(p => p.Value.Name != unique) && otherObjects.All(p => p.Value.Name != unique))
                        return unique;
                }
            }
            throw new InvalidOperationException("Could not find a unique name for object: " + name);
        }
开发者ID:Gufalagupagup,项目名称:raml-dotnet-tools,代码行数:20,代码来源:UniquenessHelper.cs

示例5: JustAttributes

        static bool JustAttributes(IDictionary<string, CfgMetadata> meta, object node) {
            if(meta.All(kv => kv.Value.ListType == null))
                return true;

            foreach(var pair in meta.Where(kv=>kv.Value.ListType != null)){
                var list = (IList)meta[pair.Key].Getter(node);
                if (list != null && list.Count > 0)
                    return false;
            }
            return true;
        }
开发者ID:modulexcite,项目名称:Cfg-NET,代码行数:11,代码来源:XmlSerializer.cs

示例6: GetUniqueKey

        public static string GetUniqueKey(IDictionary<string, ApiObject> objects, string key, IDictionary<string, ApiObject> otherObjects)
        {
            for (var i = 0; i < 100; i++)
            {
                var unique = key + i;
                if (objects.All(p => !string.Equals(p.Key, unique, StringComparison.OrdinalIgnoreCase))
                    && otherObjects.All(p => !string.Equals(p.Key, unique, StringComparison.OrdinalIgnoreCase)))
                    return unique;
            }

            foreach (var suffix in Suffixes)
            {
                for (var i = 0; i < 100; i++)
                {
                    var unique = key + suffix + i;
                    if (objects.All(p => !string.Equals(p.Key, unique, StringComparison.OrdinalIgnoreCase))
                        && otherObjects.All(p => !string.Equals(p.Key, unique, StringComparison.OrdinalIgnoreCase)))
                        return unique;
                }
            }
            throw new InvalidOperationException("Could not find a key name for object: " + key);
        }
开发者ID:Gufalagupagup,项目名称:raml-dotnet-tools,代码行数:22,代码来源:UniquenessHelper.cs

示例7: CheckForExistingProperty

        private static object CheckForExistingProperty(object item2, PropertyInfo fi, IDictionary<string, object> result)
        {
            var newValue = fi.GetValue(item2, null);
            if (result.All(x => x.Key != fi.Name))
            {
                return newValue;
            }

            var foundProperty = result.Single(x => x.Key == fi.Name);

            if (!foundProperty.Value.Equals(newValue))
            {
                throw new Exception("Merging Property with different values - " + fi.Name);
            }
            return newValue;
        }
开发者ID:brentonmcs,项目名称:DapperContext,代码行数:16,代码来源:DapperContext.cs

示例8: WaitChildForCompleted

		void WaitChildForCompleted (ObjectValue val, IDictionary<ObjectValue, bool> evaluatingList, bool hasMore)
		{
			view.WriteOutput ("\n ");

			var mark = view.Buffer.CreateMark (null, view.InputLineEnd, true);
			var iteration = 0;

			GLib.Timeout.Add (100, () => {
				if (!val.IsEvaluating) {
					PrintChildValueAtMark (val, mark);

					lock (mutex) {
						// Maybe We don't need this lock because children evaluation is done synchronously
						evaluatingList[val] = true;
						if (evaluatingList.All (x => x.Value))
							FinishPrinting (hasMore);
					}

					return false;
				}

				string prefix = "\t" + val.Name + ": ";

				if (++iteration == 5) {
					SetLineText (prefix + GettextCatalog.GetString ("Evaluating"), mark);
				} else if (iteration > 5 && (iteration - 5) % 10 == 0) {
					string points = string.Join ("", Enumerable.Repeat (".", iteration / 10));
					SetLineText (prefix + GettextCatalog.GetString ("Evaluating") + " " + points, mark);
				}

				return true;
			});
		}	
开发者ID:rae1,项目名称:monodevelop,代码行数:33,代码来源:ImmediatePad.cs

示例9: AddObjectToObjectCollectionOrLink

	    private void AddObjectToObjectCollectionOrLink(ApiObject obj, string key, IDictionary<string, ApiObject> objects)
	    {
            if (obj == null || !obj.Properties.Any())
                return;

            if (objects.All(o => o.Value.Name != obj.Name))
	        {
                objects.Add(key, obj);
	        }
	        else
	        {
	            if (!linkKeysWithObjectNames.ContainsKey(key))
	                linkKeysWithObjectNames.Add(key, obj.Name);
	        }
	    }
开发者ID:Kristinn-Stefansson,项目名称:raml-dotnet-tools,代码行数:15,代码来源:GeneratorServiceBase.cs

示例10: SetProperties

 /// <summary>
 /// Sets the values of the Configuration properties.
 /// </summary>
 /// <param name="properties"></param>
 public void SetProperties(IDictionary<string, string> properties)
 {
     if (this.sessionFactory == null && properties != null && properties.Count > 0)
         properties.All
             (
                 current =>
                     {
                         this.OverrideProperty(current.Key, current.Value);
                         return true;
                     }
             );
 }
开发者ID:TheHunter,项目名称:PersistentLayer.NHibernate,代码行数:16,代码来源:NhConfigurationBuilder.cs

示例11: AddObjectToObjectCollectionOrLink

        private void AddObjectToObjectCollectionOrLink(ApiObject obj, string key, IDictionary<string, ApiObject> objects, IDictionary<string, ApiObject> otherObjects)
        {
            if (obj == null || (!obj.Properties.Any() && obj.Type == null))
                return;

            if (schemaObjects.All(o => o.Value.Name != obj.Name) && objects.All(o => o.Value.Name != obj.Name) && otherObjects.All(o => o.Value.Name != obj.Name))
            {
                objects.Add(key, obj);
            }
            else
            {
                if (UniquenessHelper.HasSameProperties(obj, objects, key, otherObjects, schemaObjects))
                {
                    if (string.IsNullOrWhiteSpace(obj.GeneratedCode) && !linkKeysWithObjectNames.ContainsKey(key))
                        linkKeysWithObjectNames.Add(key, obj.Name);
                }
                else if(!objects.ContainsKey(key))
                {
                    obj.Name = UniquenessHelper.GetUniqueName(objects, obj.Name, schemaObjects, schemaObjects);
                    objects.Add(key, obj);
                }
            }
        }
开发者ID:dmalanij,项目名称:raml-dotnet-tools,代码行数:23,代码来源:GeneratorServiceBase.cs

示例12: PostTestResultToAppveyor

        private static void PostTestResultToAppveyor(IDictionary<string, PlatformResult> dict)
        {
            var tempResult = ResultKind.NoError;
            var tempPlatform = Enumerable.Empty<string>();
            if (dict.Any(it => it.Value.Result.Kind == ResultKind.Fail))
            {
                if (dict.All (it => it.Value.Result.Kind == ResultKind.Fail))
                    tempPlatform = new[]{ "All" };
                else
                    tempPlatform =  dict.Where (it => it.Value.Result.Kind == ResultKind.Fail).Select(it=>it.Value.Platform);
            }
            else if (dict.Any(it => it.Value.Result.Kind == ResultKind.Error))
            {
                if (dict.All (it => it.Value.Result.Kind == ResultKind.Error))
                    tempPlatform = new[]{ "All" };
                else
                    tempPlatform =  dict.Where (it => it.Value.Result.Kind == ResultKind.Error).Select(it=>it.Value.Platform);

            }
            else if (dict.Any(it => it.Value.Result.Kind == ResultKind.Ignore))
            {
                if (dict.All (it => it.Value.Result.Kind == ResultKind.Ignore))
                    tempPlatform = new[]{ "All" };
                else
                    tempPlatform =  dict.Where (it => it.Value.Result.Kind == ResultKind.Ignore).Select(it=>it.Value.Platform);
            }
            else if (dict.All(it => it.Value.Result.Kind == ResultKind.Success))
            {
                if (dict.All (it => it.Value.Result.Kind == ResultKind.Success))
                    tempPlatform = new[]{ "All" };
                else
                    tempPlatform =  dict.Where (it => it.Value.Result.Kind == ResultKind.Success).Select(it=>it.Value.Platform);
            }
            else
            {
                if (dict.All (it => it.Value.Result.Kind == ResultKind.NoError))
                    tempPlatform = new[]{ "All" };
                else
                    tempPlatform =  dict.Where (it => it.Value.Result.Kind == ResultKind.NoError).Select(it=>it.Value.Platform);
            }

            string outcome = null;
            switch (tempResult)
            {
                case ResultKind.Success:
                    outcome = "Passed";
                    break;
                case ResultKind.Fail:
                    outcome = "Failed";
                    break;
                case ResultKind.Error:
                    outcome = "NotRunnable";
                    break;
                case ResultKind.Ignore:
                    outcome = "Ignored";
                    break;
                case ResultKind.NoError:
                    outcome = "Inconclusive";
                    break;
            }

            var result = dict.Values.Select (it=>it.Result).First();

            var fullName = string.Format("{0}.{1}.{2} [{3}]", result.Test.Name, result.Test.Fixture.Name,
            result.Test.Fixture.Assembly.Name, tempPlatform);

            var json = string.Format(@"{{
                                        'testName': '{0}',
                                        'testFramework': '{1}',
                                        'fileName': '{2}',
                                        'outcome': '{3}',
                                        'durationMilliseconds': '{4}',
                                        'ErrorMessage': '',
                                        'ErrorStackTrace': '',
                                        'StdOut': '{5}',
                                        'StdErr': ''
                                    }}",
                                     fullName.EscapeJson(),
                                     "PclUnit",
                                     result.Test.Fixture.Assembly.Name.EscapeJson(),
                                     outcome.EscapeJson(),
                                     (result.EndTime - result.StartTime).Milliseconds,
                                     result.Output.EscapeJson()
                );

            PostToAppVeyor(json);
        }
开发者ID:jbtule,项目名称:PclUnit,代码行数:87,代码来源:PrintResults.cs

示例13: PrintResult

        public static void PrintResult(IDictionary<string, PlatformResult> dict)
        {
            if (dict.All(it => it.Value.Result != null))
            {

                if (AppVeyor)
                {
                    PostTestResultToAppveyor(dict);
                }

                var result = dict.Select(it => it.Value.Result).First();
                if (TeamCity)
                {
                    Console.WriteLine("##teamcity[testStarted name='{2}.{1}.{0}' captureStandardOutput='true']",
                                      result.Test.Name.TeamCityEncode(),
                                      result.Test.Fixture.Name.TeamCityEncode(),
                                      result.Test.Fixture.Assembly.Name.TeamCityEncode());
                }
                else if(Verbose)
                {
                    Console.Write(result.Test.Fixture.Assembly.Name + ".");
                    Console.Write(result.Test.Fixture.Name + ".");
                }
                if (TeamCity || Verbose) {
                  Console.WriteLine (result.Test.Name);
                }
                foreach (var grpResult in dict.GroupBy(it => it.Value.Result.Kind))
                {
                  if (Verbose || TeamCity) {
                    Console.Write ("{0}:", grpResult.Key);
                    foreach (var keyValuePair in grpResult) {
                      Console.Write (" ");
                      Console.Write (keyValuePair.Value.Platform);
                    }
                  }
                    if (TeamCity)
                    {
                        switch (grpResult.Key)
                        {
                            case ResultKind.Fail:
                            case ResultKind.Error:
                                Console.WriteLine(
                                    "##teamcity[testFailed name='{2}.{1}.{0}' message='See log or details']",
                                      result.Test.Name.TeamCityEncode(),
                                      result.Test.Fixture.Name.TeamCityEncode(),
                                      result.Test.Fixture.Assembly.Name.TeamCityEncode());
                                break;
                            case ResultKind.Ignore:
                                Console.WriteLine(
                                    "##teamcity[testIgnored name='{2}.{1}.{0}' message='See log or details']",
                                      result.Test.Name.TeamCityEncode(),
                                      result.Test.Fixture.Name.TeamCityEncode(),
                                      result.Test.Fixture.Assembly.Name.TeamCityEncode());
                                break;
                        }

                    }
                  if (Verbose || TeamCity) {
                    Console.WriteLine ();
                  }
                }
            if (Verbose || TeamCity) {
              var span = new TimeSpan ();
              foreach (var r in dict.Select(it => it.Value.Result)) {
            span += (r.EndTime - r.StartTime);
              }
              Console.WriteLine ("avg time:{0}", new TimeSpan (span.Ticks / dict.Count));
            }

            if (Verbose || TeamCity) {

                    foreach (var lup in dict.ToLookup(it => it.Value.Result.Output)) {
                        var name = String.Join (",", lup.Select (it => it.Value.Platform));

                        Console.WriteLine ("{0}:", name);
                        Console.WriteLine (lup.Key);
                    }
                }

                if (TeamCity)
                {
                    Console.WriteLine("##teamcity[testFinished name='{2}.{1}.{0}' duration='{3}']",
                         result.Test.Name.TeamCityEncode(),
                         result.Test.Fixture.Name.TeamCityEncode(),
                         result.Test.Fixture.Assembly.Name.TeamCityEncode(),
                        (result.EndTime - result.StartTime).TotalMilliseconds);
                }
                else
                {

                    if (dict.Any(it => it.Value.Result.Kind == ResultKind.Fail))
                    {
                        if (Verbose)
                            Console.WriteLine ("!!!!!!!!!!!!!!!!!!!!!!!!!");
                        else if (dict.All(it => it.Value.Result.Kind == ResultKind.Fail))
                            Console.Write("!  ");
                        else
                            Console.Write ("!{0} ", dict.Where (it => it.Value.Result.Kind == ResultKind.Fail).Count ());
                    }
                    else if (dict.Any(it => it.Value.Result.Kind == ResultKind.Error))
//.........这里部分代码省略.........
开发者ID:jbtule,项目名称:PclUnit,代码行数:101,代码来源:PrintResults.cs

示例14: GetUniqueName

 private string GetUniqueName(IDictionary<string, ApiEnum> enums, string name)
 {
     for (var i = 0; i < 9; i++)
     {
         var unique = name + suffixes[i];
         if (enums.All(p => p.Key != unique))
             return unique;
     }
     for (var i = 0; i < 100; i++)
     {
         var unique = name + "A" + i;
         if (enums.All(p => p.Key != unique))
             return unique;
     }
     throw new InvalidOperationException("Could not find a unique name for enum");
 }
开发者ID:Kristinn-Stefansson,项目名称:raml-dotnet-tools,代码行数:16,代码来源:JsonSchemaParser.cs

示例15: match

 // Returns true if the row matches the key/value pairs.
 bool match(Item i, IDictionary<string, object> constraints)
 {
     return constraints.All(
     c => i.values.ContainsKey(c.Key) && i.values[c.Key].Equals(c.Value)
     );
 }
开发者ID:kayateia,项目名称:climoo,代码行数:7,代码来源:MemoryDatabase.cs


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