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


C# IDictionary.ToDictionary方法代码示例

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


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

示例1:

 IMockNetworkWithReturn IMockNetworkWithExpectation.Returning(HttpStatusCode statusCode, string responseContent, IDictionary<string, string> responseHeaders)
 {
     _statusCode = statusCode;
     _responseContent = responseContent;
     _responseHeaders = responseHeaders.ToDictionary(kvp => kvp.Key.ToLowerInvariant(), kvp => kvp.Value);
     return this;
 }
开发者ID:GtJosh,项目名称:ds3_net_sdk,代码行数:7,代码来源:MockNetwork.cs

示例2: EnsureClientDimensionsExist

        public static async Task<IDictionary<string, int>> EnsureClientDimensionsExist(SqlConnection connection, IDictionary<string, Tuple<int, ClientDimension>> recognizedUserAgents)
        {
            var results = new Dictionary<string, int>();

            var command = connection.CreateCommand();
            command.CommandText = "[dbo].[EnsureClientDimensionsExist]";
            command.CommandType = CommandType.StoredProcedure;
            command.CommandTimeout = _defaultCommandTimeout;

            var parameterValue = ClientDimensionTableType.CreateDataTable(recognizedUserAgents.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.Item2));

            var parameter = command.Parameters.AddWithValue("clients", parameterValue);
            parameter.SqlDbType = SqlDbType.Structured;
            parameter.TypeName = "[dbo].[ClientDimensionTableType]";

            using (var dataReader = await command.ExecuteReaderAsync())
            {
                while (await dataReader.ReadAsync())
                {
                    var clientDimensionId = dataReader.GetInt32(0);
                    var userAgent = dataReader.GetString(1);

                    results.Add(userAgent, clientDimensionId);
                }
            }

            return results;
        }
开发者ID:joyhui,项目名称:NuGet.Jobs,代码行数:28,代码来源:Warehouse.cs

示例3: GetParameters

		public IDictionary<string,Parameter> GetParameters(IDictionary<string, object> dictionary)
		{
            if (dynamicRaml == null)
                return new Dictionary<string, Parameter>();

			return dictionary.ToDictionary(kv => kv.Key, kv => (new ParameterBuilder()).Build((IDictionary<string, object>)kv.Value));
		}
开发者ID:furesoft,项目名称:raml-dotnet-parser,代码行数:7,代码来源:BodyBuilder.cs

示例4: BinaryDecisionTreeParentNode

 public BinaryDecisionTreeParentNode(
     bool isLeaf, 
     string decisionFeatureName, 
     IDictionary<IDecisionTreeLink, IDecisionTreeNode> linksToChildren, 
     object decisionValue, 
     bool isSplitValueNumeric)
     : base(isLeaf, decisionFeatureName, linksToChildren)
 {
     IsValueNumeric = isSplitValueNumeric;
     DecisionValue = decisionValue;
     TestResultsWithChildren = linksToChildren.ToDictionary(
         kvp => kvp.Key as IBinaryDecisionTreeLink,
         kvp => kvp.Value);
     foreach (var link in linksToChildren)
     {
         var binaryTreeLink = link.Key as IBinaryDecisionTreeLink;
         if (binaryTreeLink != null)
         {
             if (!binaryTreeLink.LogicalTestResult)
             {
                 LeftChild = link.Value;
                 LeftChildLink = binaryTreeLink;
             }
             else
             {
                 RightChild = link.Value;
                 RightChildLink = binaryTreeLink;
             }
         }
     }
 }
开发者ID:Animattronic,项目名称:BrainSharper,代码行数:31,代码来源:BinaryDecisionTreeParentnode.cs

示例5: OverrideValueProvider

 public OverrideValueProvider(IValueProvider originalValueProvider, IDictionary<string, string> values)
 {
     OriginalValueProvider = originalValueProvider;
     HardcodedValues = values.ToDictionary(
         x => x.Key,
         x => new ValueProviderResult(x.Value, x.Value, System.Globalization.CultureInfo.InvariantCulture));
 }
开发者ID:newaccount978,项目名称:CommonJobs,代码行数:7,代码来源:OverrideValueProvider.cs

示例6: Request

 public Request(string url, string verb, string body, IDictionary<string, string> headers)
 {
     _url = url;
     _headers = headers.ToDictionary(kv => kv.Key.ToLower(), kv => kv.Value.ToLower());
     _verb = verb.ToLower();
     _body = body==null ? "" : body.Trim();
 }
开发者ID:jbuiss0n,项目名称:mock4net,代码行数:7,代码来源:Request.cs

示例7: TangerineConfiguration

        /// <summary>
        /// Initializes a new instance of the <see cref="Craswell.WebRepositories.Tangerine.TangerineConfiguration"/> class.
        /// </summary>
        /// <param name="webSiteAddress">Web site address.</param>
        /// <param name="acn">The account client number.</param>
        /// <param name="pin">The client pin.</param>
        /// <param name="securityQuestions">The client security questions.</param>
        public TangerineConfiguration(
            Uri webSiteAddress,
            string acn,
            string pin,
            IDictionary<string, string> securityQuestions)
        {
            if (string.IsNullOrEmpty(acn))
            {
                throw new ArgumentNullException("acn");
            }

            if (string.IsNullOrEmpty(pin))
            {
                throw new ArgumentNullException("pin");
            }

            if (webSiteAddress == null)
            {
                throw new ArgumentNullException("webSiteAddress");
            }

            if (securityQuestions == null)
            {
                throw new ArgumentNullException("securityQuestions");
            }

            this.acn = acn;
            this.pin = pin;
            this.webSiteAddress = webSiteAddress;

            this.securityQuestions = securityQuestions
                .ToDictionary(d => d.Key, d => d.Value);
        }
开发者ID:scraswell,项目名称:web-repositories,代码行数:40,代码来源:TangerineConfiguration.cs

示例8: BuildOptionDictionary

 static IDictionary<string, IOptionApplier> BuildOptionDictionary(
     IDictionary<string, IDictionary<string, JToken>> jsonOptions, IReadOnlyList<IOption> supportedOptions)
 {
     return jsonOptions.ToDictionary(
         o => o.Key,
         o => (IOptionApplier)new JsonOptionApplier(o.Key, o.Value, supportedOptions));
 }
开发者ID:nicholjy,项目名称:stylize,代码行数:7,代码来源:JsonConfigurationParser.cs

示例9: BuildTextureMap

        private short[,] BuildTextureMap(IDictionary<TextureGroup, byte> textureGroupIds,
            IDictionary<Tuple<byte, byte>, TextureGroupTransition> textureTansitionLookup,
            byte[,] textureGroupMap)
        {
            var idsToTextureGroups = textureGroupIds.ToDictionary(item => item.Value, item => item.Key);

            return null;
        }
开发者ID:Talisan,项目名称:Terrastructor,代码行数:8,代码来源:HeightmapTextureProcessor.cs

示例10: ObjectSubclassingController

    public ObjectSubclassingController(IDictionary<Type, Action> actions) {
      mutex = new ReaderWriterLockSlim();
      registeredSubclasses = new Dictionary<String, ObjectSubclassInfo>();
      registerActions = actions.ToDictionary(p => GetClassName(p.Key), p => p.Value);

      // Register the ParseObject subclass, so we get access to the ACL,
      // objectId, and other ParseFieldName properties.
      RegisterSubclass(typeof(ParseObject));
    }
开发者ID:cnbcyln,项目名称:Parse-SDK-dotNET,代码行数:9,代码来源:ObjectSubclassingController.cs

示例11: RedisExtensions

 static RedisExtensions()
 {
     getCommand = new Dictionary<string,Type>{
         {"AddCustomerCommand", typeof(AddCustomerCommand)},
         {"AddOrderCommand"   , typeof(AddOrderCommand)},
         {"AddProductCommand" , typeof(AddProductCommand)},
         {"AddProductToOrder" , typeof(AddProductToOrder)},
     };
     getName = getCommand.ToDictionary(kv => kv.Value, kv => kv.Key);
 }
开发者ID:wallymathieu,项目名称:redis-studies,代码行数:10,代码来源:RedisExtensions.cs

示例12: InvokeMethod

 public IEnumerable<string> InvokeMethod(Models.Method method, IDictionary<string, object> form)
 {
     using (var build = Build())
     {
         return build
             .Controller(method.ClassName)
             .Action(method.Name)
             .Parameters(form.ToDictionary(p => p.Key, p => p.Value != null ? p.Value.ToString() : (string)null))
             .Invoke();
     }
 }
开发者ID:wallymathieu,项目名称:isop,代码行数:11,代码来源:IsopServerFromBuild.cs

示例13: SaveTempData

		/// <summary>
		///     Save temp data dictionary to the specified <see cref="HttpContext" /> object.
		/// </summary>
		/// <param name="context">The <see cref="HttpContext" /> object.</param>
		/// <param name="values">The temp data dictionary to be saving.</param>
		public override void SaveTempData(HttpContext context, IDictionary<string, object> values)
		{
			if (values == null)
			{
				base.SaveTempData(context, null);
				return;
			}

			var newDic = values.ToDictionary(item => item.Key, item => ObjectSerializer.Serialize(item.Value));
			base.SaveTempData(context, newDic);
		}
开发者ID:sgjsakura,项目名称:AspNetCore,代码行数:16,代码来源:EnhancedSessionStateTempDataProvider.cs

示例14: ODataQueryPartTypeExtensions

        static ODataQueryPartTypeExtensions()
        {
            var fields = Enum.GetNames(typeof (ODataQueryPartType))
                .Select(typeof (ODataQueryPartType).GetField)
                .ToList();

            TypeToParameterNames = fields
                .Where(x => x.GetCustomAttributes<UrlParameterAttribute>().Any())
                .ToDictionary(key => (ODataQueryPartType)key.GetValue(null), value => value.GetCustomAttributes<UrlParameterAttribute>().Single().Name);

            ParameterNameToType = TypeToParameterNames.ToDictionary(key => key.Value, value => value.Key);
        }
开发者ID:chrisblock,项目名称:LinqToRest,代码行数:12,代码来源:ODataQueryPartTypeExtensions.cs

示例15: ToDynamicODataEntry

 private static IDictionary<string, object> ToDynamicODataEntry(IDictionary<string, object> entry)
 {
     return entry == null
         ? null
         : entry.ToDictionary(
                 x => x.Key,
                 y => y.Value is IDictionary<string, object>
                     ? new DynamicODataEntry(y.Value as IDictionary<string, object>)
                     : y.Value is IEnumerable<object>
                     ? ToDynamicODataEntry(y.Value as IEnumerable<object>)
                     : y.Value);
 }
开发者ID:ErikWitkowski,项目名称:Simple.OData.Client,代码行数:12,代码来源:DynamicODataEntry.cs


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