private Task WriteParameter(Stream stream, Parameter parameter)
        {
            var formattedParameter = GetFormattedParameter(parameter);
            var encoded = DefaultEncoding.GetBytes(formattedParameter);

            return Task.Factory.FromAsync(stream.BeginWrite, stream.EndWrite, encoded, 0, encoded.Length, null);
        }
 public string GetFormattedParameter(Parameter parameter)
 {
     return string.Format("--{0}{3}Content-Disposition: form-data; name=\"{1}\"{3}{2}{3}", MimeBoundary, parameter.Name, parameter.Value, Crlf);
 }
        private void WriteParameter(Stream stream, Parameter parameter)
        {
            var formattedParameter = GetFormattedParameter(parameter);

            var encoded = DefaultEncoding.GetBytes(formattedParameter);
            stream.Write(encoded, 0, encoded.Length);
        }