mixture.cylinderNumberв C# принято называть публичные свойства в CamelCase, а не lowerCamelCase.
foreach (var item in ChangeTracker.Entries<IAuditableEntity>().Where(x => x.State == EntityState.Modified))
{
item.DateUpdate = DateTime.Now;
}
var persons = new[]
{
new Person{ Id = 1, FirstName = "A", LastName = "A", Age = 20 },
new Person{ Id = 2, FirstName = "A", LastName = "B", Age = 20 },
new Person{ Id = 3, FirstName = "A", LastName = "C", Age = 30 },
new Person{ Id = 4, FirstName = "A", LastName = "D", Age = 30 },
new Person{ Id = 5, FirstName = "B", LastName = "A", Age = 10 },
new Person{ Id = 6, FirstName = "B", LastName = "B", Age = 20 },
new Person{ Id = 7, FirstName = "B", LastName = "C", Age = 10 },
};
var result = persons.GroupBy(x => new { x.FirstName, x.Age }).Select(x => x.First());
foreach (var element in result)
{
Console.WriteLine(element);
}
class Person
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public override string ToString() => $"{Id}, {FirstName}, {LastName}, {Age}";
}
internal static class RuleExtensions
{
public static IRuleBuilderOptions<T, int> ValidateId<T>(this IRuleBuilder<T, int> builder)
where T : IHasId
{
return builder.Must((t, x) => t.Id > 5);
}
}
class FirstTestValidator : AbstractValidator<FirstTest>
{
public FirstTestValidator()
{
RuleFor(x => x.Id).ValidateId().DependentRules(() =>
{
RuleFor(x => x.Guid).NotEmpty();
});
}
}
private ServerGroup selectedGroup;
public ServerGroup SelectedGroup
{
get => selectedGroup;
set
{
selectedGroup = value;
loadProcesses();
}
}
public ObservableCollection<ServerGroup> Groups { get; }
public ObservableCollection<Process> Processes { get; }
private async void loadProcesses()
{
Processes.Clear();
//get response from API, etc.
var response = new List<Process>(); //example
response.ForEach(Processes.Add);
}
<ComboBox SelectedItem="{Binding SelectedGroup}" ItemsSource="{Binding Groups}"/>
<ComboBox SelectedItem="{Binding ......}" ItemsSource="{Binding Processes}"/>
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Seq",
"Args": {
"serverUrl": "http://localhost:5341/",
"apiKey": "key",
"restrictedToMinimumLevel": "Warning"
}
}
]
class Root
{
public List<Data> Data { get; set; }
public int Timestamp { get; set; }
}
class Data
{
public string Id { get; set; }
public string Rank { get; set; }
public string Symbol { get; set; }
public string Name { get; set; }
public string Supply { get; set; }
public string MaxSupply { get; set; }
public string MarketCapUsd { get; set; }
public string VolumeUsd24Hr { get; set; }
public string PriceUsd { get; set; }
public string ChangePercent24Hr { get; set; }
public string Vwap24Hr { get; set; }
public string Explorer { get; set; }
}