public void AddTextPart(string value, Encoding encoding = null, IEnumerable <KeyValuePair <string, string> > properties = null) { var content = encoding == null ? new StringContent(value) : new StringContent(value, encoding); foreach (var property in properties) { content.Headers.Add(property.Key, property.Value); } MultiPartContents.Add(content); }
public void AddFilePart(string name, Stream stream, int bufferSize, IEnumerable <KeyValuePair <string, string> > properties = null) { var content = bufferSize == -1 ? new StreamContent(stream) : new StreamContent(stream, bufferSize); foreach (var property in properties) { content.Headers.Add(property.Key, property.Value); } MultiPartContents.Add(content); }