public static void Main()
string FilePath = "file3.txt";
RequestJson requestJson = new RequestJson();
requestJson.uploadFile = FilePath;
requestJson.userName = "Nation";
requestJson.email = "Nation@xyz.com";
var content = new MultipartFormDataContent();
foreach (PropertyInfo prop in typeof(RequestJson).GetProperties(BindingFlags.Instance|BindingFlags.GetProperty|BindingFlags.Public))
if (prop.Name == "uploadFile")
var fileContent = new ByteArrayContent(new byte[10], 0, 0);
content.Add(fileContent, prop.Name, prop.GetValue(requestJson).ToString());
content.Add(new StringContent(JsonConvert.SerializeObject(prop.GetValue(requestJson))), prop.Name);
Console.WriteLine(JsonConvert.SerializeObject(content, Formatting.Indented));
public string uploadFile { get; set; }
public string userName { get; set; }
public string email { get; set; }