locked
How do i split ReadAsStringAsync value to list array using linq C# RRS feed

  • Question

  • User-1024101449 posted

    Hi,

    i am using Content.ReadAsStringAsync().Result for receiving output from service.

    i am getting the below format output.

    Code : 

    var Values = response.Content.ReadAsStringAsync().Result;

    Return Output :

    ["AK-01AF,1","MLM-01032,0"]

    Finally i want to split to array using below code. but, it it not working

    var Values = response.Content.ReadAsStringAsync().Result;
    string[] FinalOutput = Valuess.Split(',').ToArray();

    My Final Output should be :

    ["AK-01AF"]    ==> [0-th index]

    ["MLM-01032"] ==> [1st index]

    How to format my output like above...?

    Thursday, November 29, 2018 11:02 AM

Answers

All replies

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 29, 2018 12:10 PM
  • User-1024101449 posted

    Thanks for your reply.

     i am unable to use and install Newtonsoft.Json both in VS2010 and VS2013. i tried many ways. but, no luck

    if i install then only i can able to Deserialize a Collection

    i am gettiing following error while installing Newtonsoft.Json in Nuget packages online.

    "The 'Newtonsoft.Json 12.0.1' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.50926.663'."

    Thursday, November 29, 2018 12:40 PM
  • User1520731567 posted

    Hi gani7787,

    "The 'Newtonsoft.Json 12.0.1' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.50926.663'."

    Update your NuGet Package Manager extension.

    Go to Tools->Extensions and Updates and select Updates->Visual Studio Gallery.

    Update the NuGet Package Manager extension.

    Then try to install the package after Visual Studio gets restarted.

    If  the Updates tab wasn't showing any update for Nuget extension.

    I suggest that try to install a specific lower version (6.0.3) of Newtonsoft.Json package deliberately this way:

    PM> Install-Package Newtonsoft.Json {Your Project Name} 6.0.3
    

    So, it might be the case that newer version of a nuget package is compatible with only latest version of nuget package manager.

    So sometimes explicitly installing a lower version of the package might help you.

    Older version of a nuget package will of course be compatible with older nuget extension in Visual Studio if it is not up-to-date.

    More methods,you could refer to:

    https://stackoverflow.com/questions/42173657/package-requires-nuget-client-version-2-12

    Best Regards.

    Yuki Tao

    Friday, November 30, 2018 5:59 AM