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


C# IDictionary.ToNameValueCollection方法代码示例

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


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

示例1: SendDirectMessageAndGetResponse

		public IDictionary<string, string> SendDirectMessageAndGetResponse(ServiceEndpoint providerEndpoint, IDictionary<string, string> fields) {
			OpenIdProvider provider = new OpenIdProvider(providerStore, providerEndpoint.ProviderEndpoint,
				providerEndpoint.ProviderEndpoint, fields.ToNameValueCollection());
			Debug.Assert(provider.Request.IsResponseReady, "Direct messages should always have an immediately available response.");
			Response webResponse = (Response)provider.Request.Response;
			EncodableResponse opAuthResponse = (EncodableResponse)webResponse.EncodableMessage;
			return opAuthResponse.EncodedFields;
		}
开发者ID:Belxjander,项目名称:Asuna,代码行数:8,代码来源:DirectMessageTestRedirector.cs

示例2: CreateHttpRequestInfo

		internal static HttpRequestInfo CreateHttpRequestInfo(string method, IDictionary<string, string> fields) {
			var requestUri = new UriBuilder(DefaultUrlForHttpRequestInfo);
			var headers = new NameValueCollection();
			NameValueCollection form = null;
			if (method == "POST") {
				form = fields.ToNameValueCollection();
				headers.Add(HttpRequestHeaders.ContentType, Channel.HttpFormUrlEncoded);
			} else if (method == "GET") {
				requestUri.Query = MessagingUtilities.CreateQueryString(fields);
			} else {
				throw new ArgumentOutOfRangeException("method", method, "Expected POST or GET");
			}

			return new HttpRequestInfo(method, requestUri.Uri, form: form, headers: headers);
		}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:15,代码来源:MessagingTestBase.cs

示例3: Read

        public override Result Read(string table, IDictionary<string, string> query)
        {
            var type = ResolveModelType(table);
            var param = query.ToNameValueCollection();
            var database = GetDatabase();
            var collection = database.GetCollection(ResolveModelType(table), table);
            var result = collection.FindAllAs(type);
            var data = Filter(result, type, param);

            return new Result
                {
                    Success = true,
                    Data = data
                };
        }
开发者ID:amazedsaint,项目名称:SignalWire,代码行数:15,代码来源:MongoContextProvider.cs

示例4: CreateHttpRequestInfo

		private static HttpRequestInfo CreateHttpRequestInfo(HttpDeliveryMethods scheme, IDictionary<string, string> fields) {
			var requestUri = new UriBuilder(MessagingTestBase.DefaultUrlForHttpRequestInfo);
			var headers = new NameValueCollection();
			NameValueCollection form = null;
			string method;
			switch (scheme) {
				case HttpDeliveryMethods.PostRequest:
					method = "POST";
					form = fields.ToNameValueCollection();
					headers.Add(HttpRequestHeaders.ContentType, Channel.HttpFormUrlEncoded);
					break;
				case HttpDeliveryMethods.GetRequest:
					method = "GET";
					requestUri.Query = MessagingUtilities.CreateQueryString(fields);
					break;
				case HttpDeliveryMethods.AuthorizationHeaderRequest:
					method = "GET";
					headers.Add(HttpRequestHeaders.Authorization, CreateAuthorizationHeader(fields));
					break;
				default:
					throw new ArgumentOutOfRangeException("scheme", scheme, "Unexpected value");
			}

			return new HttpRequestInfo(method, requestUri.Uri, form: form, headers: headers);
		}
开发者ID:CooPzZ,项目名称:dotnetopenid,代码行数:25,代码来源:OAuthChannelTests.cs

示例5: Post

 /// <summary>
 /// POSTs to an API URL and returns a dynamically typed object representing the
 /// response from the service.
 /// </summary>
 /// <param name="pageMethod">Page, method, or file to append to end of API URL</param>
 /// <param name="formData">String dictionary of Key/value pair query parameters (e.g. ?key=value)</param>
 /// <returns></returns>
 public dynamic Post(string pageMethod, IDictionary<string, string> formData) {
     return PerformRequest(pageMethod, HttpMethod.POST, formData.ToNameValueCollection());
 }
开发者ID:ufaruki,项目名称:.JSON,代码行数:10,代码来源:DotJson.cs

示例6: Get

 /// <summary>
 /// GETs from API URL and returns a dynamically typed object representing the
 /// response from the service.
 /// </summary>
 /// <param name="pageMethod">Page, method, or file to append to end of API URL</param>
 /// <param name="queryParams">String dictionary of Key/value pair query parameters (e.g. ?key=value)</param>
 /// <returns></returns>
 public dynamic Get(string pageMethod, IDictionary<string, string> queryParams) {
     return PerformRequest(pageMethod, HttpMethod.GET, queryParams.ToNameValueCollection());
 }
开发者ID:ufaruki,项目名称:.JSON,代码行数:10,代码来源:DotJson.cs


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