public MyClass()
{
MyCommand = new DelegateCommand(AnyAction);
}
public ICommand MyCommand {get;}
void AnyAction()
{
//code
}
public class Animal
{
[Key]
public int AnimalId { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public Eat Eats { get; set; }
public virtual ICollection<Staff> { get; set; }
}
//Метод контроллера, который вызывается при переходе на страницу. (example: localhost/Home/ShowStaff/2959)
public async Task<IActionResult> ShowStaff(int animalId)
{
var result = await context.Animals.Include(x => x.Staff).FirstOrDefault(x => x.AnimalId == animalId); //Получаем всех сотрудников для животного
return View(result); //отдаем результат во view
}
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();
}