小编eld*_*ano的帖子

如何使用JSONConvert将变量Result转换为对象?

我正在使用.NET Core for Linux进行控制台程序.使用Http功能我可以从Web服务获得一些信息.然后我试图将结果转换为对象,但我无法使用JSON.

我读过这篇文章,但是我没有找到任何示例,也没有访问JavaScriptSerializer的权限

    public async void CallApi(Object stateInfo)
    {
        var client = new HttpClient();
        var requestContent = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("pair", "XETHZEUR"), });
        HttpResponseMessage response = await client.PostAsync("https://api.kraken.com/0/public/Trades", requestContent);
        HttpContent responseContent = response.Content;
        using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
        {
            String result = await reader.ReadToEndAsync();
            //Here I would like to do a deserialized of my variable result using JSON (JObject obj = (JObject)JsonConvert.DeserializeObject(result);) But I don't find any JSON object
        }
    }
Run Code Online (Sandbox Code Playgroud)

编辑 …

c# console json .net-core

6
推荐指数
1
解决办法
2万
查看次数

Powershell - SetForegroundWindow

使用PowerShell代码我尝试更改窗口的位置(正常工作)并将此窗口"始终在顶部".

请在下面找到我的代码:

Import-Module C:/install/WASP/wasp.dll

for($i=1; $i -le 300000; $i++)
{
    $allWindow = Select-Window MyCheck*
    if($allWindow)
    {
        foreach ($currentWindow in $allWindow) 
        {
            $positionWindow = WindowPosition $currentWindow
            foreach ($currentPosition in $positionWindow) 
            {
                #if we find the correct windows
                if ( $currentWindow.title -match "\([0-9]*\)#" )
                {
                    #write-host "@@##@@"$currentWindow.title",(@@#@@)"$currentPosition.x",(@@#@@)"$currentPosition.y",(@@#@@)"$currentPosition.width",(@@#@@)"$currentPosition.height",(@@#@@)"$currentWindow.title",(@@#@@)"$currentWindow.IsActive

                    $id = $currentWindow.title.Substring($currentWindow.title.IndexOf("(")+1, $currentWindow.title.IndexOf(")")-$currentWindow.title.IndexOf("(")-1)
                    $allHUDWindow = Select-Window * | where {$_.Title -match "\($id\).*.txt"}
                    #If we find the second window, we have to superimpose $currentHUDWindow to $currentWindow
                    if($allHUDWindow)
                    {
                        foreach ($currentHUDWindow in $allHUDWindow) 
                        {

                            #I need …
Run Code Online (Sandbox Code Playgroud)

powershell powershell-2.0

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net-core ×1

c# ×1

console ×1

json ×1

powershell ×1

powershell-2.0 ×1