• /r/csharp
  • How to write a Web API endpoint that takes file content as arraybuffer?

    This is how I am POSTing the file from client: function upload(file) { var reader = new FileReader(); reader.onloadend = function (e) { var buffer = e.target.result; ajax(buffer, file); }; reader.readAsArrayBuffer(file); } function ajax(buffer, file) { let oReq = new XMLHttpRequest(); oReq.open(‘PUT’, ‘/api/files/upload’ + file.name, true); oReq.onload = function(e) { if (oReq.status >= 200 && […]

  • /r/csharp
  • New to C# – parsing

    So I am new to C# and I am currently learning the basics in the console. So, my simple question is why can we parse numbers like this: double a = double.Parse(Console.ReadLine()); but I can’t use var.Parse for this .. var name = Console.ReadLine(); I tried changing var name to string name and use string.Parse […]