I created an array and I want to send it to a C# application. I want to be able to use it as a C# string array so I can create a for loop where I can run some tasks.
Node.js (Express.js)
router.get('/arr', function(req,res,next) {
var arr = ["orange", "plum", "strawberry", "lemon", "tangerine"];
res.send(arr);
});
C# code.
public string Arr() {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://10.0.2.2/arr");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader stream = new StreamReader(response.GetResponseStream());
string final_response = stream.ReadToEnd();
stream.Dispose();
return final_response;
}
C# application's editor (This is an editor where I can do very limited stuff, so there's no way to import 3rd party packages but you can do basic stuff like http get/post, etc)
string Answer = Lib.Arr();
How can I create Answer
as a string array? I tried creating Answer
as string[] Answer
but it says string can't get converted into string[], where am I wrong?
I'm new to C#.