class Ret
{
public Ret()
{
Words = new List<string>();
}
public List<string> Words { get; set; }
}
class RequestData
{
public RequestData()
{
Ret = new Ret();
}
[JsonPropertyName("ret")]
public Ret Ret { get; set; }
}
RequestData rd = new RequestData();
rd.Ret.Words.Add("Hello");
rd.Ret.Words.Add("World!");
var json = JsonSerializer.Serialize(rd);
Console.WriteLine(Convert.ToString(5000, 2)); // -> Вывод: 1001110001000
<Image
x:Class="Malinka.Controls.BackgroundImage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="imageBase"
mc:Ignorable="d"
Source="{Binding Settings.ImagePath, ElementName=imageBase, Converter={StaticResource BackgroundImageConverter}}"
Stretch="UniformToFill">
<Image.Effect>
<BlurEffect Radius="{Binding Settings.Blur, ElementName=imageBase}"/>
</Image.Effect>
</Image>
using System.Net;
string postData = "post string";
byte[] data = Encoding.ASCII.GetBytes(postData);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://122.233.155.155:80");
req.Method = "POST";
req.ContentLength = postData.Length;
req.Timeout = 10000;
using (Stream stream = req.GetRequestStream()) stream.Write(data, 0, data.Length);
using (HttpWebResponse response = (HttpWebResponse)req.GetResponse())
{
var buffer = new byte[response.ContentLength];
response.GetResponseStream().Read(buffer, 0, buffer.Length);
Console.WriteLine(buffer.Length);
}
public int[] ParseString(string str)
{
return str.Split(' ').Select(x => int.Parse(x)).ToArray();
}