Microsoft.Http.HttpMultipartMimeForm.Add C# (CSharp) Méthode

Add() public méthode

public Add ( string key, string value ) : void
key string
value string
Résultat void
        public void Add(string key, string value)
        {
            this.Values.Add(new HttpFormValue()
            {
                Name = key,
                Value = value
            });
        }

Same methods

HttpMultipartMimeForm::Add ( string name, string fileName, HttpContent content ) : void

Usage Example

        /// <summary>
        /// Validates the given user’s application key.
        /// </summary>
        /// <returns>OK, nick, name. Error message on failure.</returns>
        public UserValidateResponse Validate()
        {
            using (var client = GetDefaultClient())
            {
                // build form data post
                HttpMultipartMimeForm form = new HttpMultipartMimeForm();
                form.Add("app_key", this.AppKey);
                form.Add("user_key", this.UserKey);

                // call method
                using (HttpResponseMessage response = client.Post("user.validate", form.CreateHttpContent()))
                {
                    response.EnsureStatusIsSuccessful();
                    return response.Content.ReadAsXmlSerializable<UserValidateResponse>();
                }
            }
        }
All Usage Examples Of Microsoft.Http.HttpMultipartMimeForm::Add