public int Num
{
get => _num; // а это новая форма записи, короче и красивей той что у вас
set =>_num = value; // Присвоение значения собственно почему у вас и ругается, нет этого метода
}
public int NumSecond
{
get => _sec; // а это новая форма записи, короче и красивей той что у вас
private set =>_sec = value; // А тут закрываете доступ извне
}
const ready = (callback: { (): void; (): void }) => {
if (document.readyState !== 'loading') {
callback();
} else {
document.addEventListener('DOMContentLoaded', callback);
}
};
ready(() => {
window.addEventListener('scroll', (e: Event) => {
const top = document.documentElement.scrollTop;
const pos = (top / 3).toFixed(2);
const splash = document.querySelector('.splash') as HTMLDivElement;
if (splash !== null) {
splash.style.backgroundPosition = '0px -' + pos + 'px';
}
const homeNavbar = document.querySelector(
'#home > .navbar',
) as HTMLDivElement;
if (top > 50) {
homeNavbar.classList.remove('is-transparent');
} else {
homeNavbar.classList.add('is-transparent');
}
});
const abar = document.querySelector('a[href="/#"]') as HTMLAnchorElement;
abar.addEventListener('click', (e: any) => {
e.preventDefault();
});
});
GET /api/dbsync/getdictionaries/
{
"schema": "0.4",
[
{ "name":"cityes", "sql": "create table ....."},
.....
]
}
void Test()
{
var peoples = new People[]
{
new People{LastName = "Ivanov", Name = "Ivan", School = 17, One = 5, Two = 4},
new People{LastName = "Petrov", Name = "Petr", School = 17, One = 5, Two = 3},
new People{LastName = "Dariyana", Name = "Daria", School = 17, One = 5, Two = 4},
new People{LastName = "Ivanov", Name = "Ivan", School = 16, One = 5, Two = 4},
new People{LastName = "Petrov", Name = "Petr", School = 16, One = 5, Two = 3},
new People{LastName = "Dariyana", Name = "Daria", School = 16, One = 5, Two = 4},
new People{LastName = "Dariyana", Name = "Daria", School = 19, One = 2, Two = 2},
};
var path = "file.xml";
Save(path,peoples);
peoples = Load(path);
var schoolList = peoples.Select(s => s.School).Distinct();
var best =
(from sn in schoolList let max = peoples.Where(s => s.School == sn)
.Max(x => x.One + x.Two)
select
peoples.First(x => x.School == sn && (x.One + x.Two) == max))
.ToList();
;
}
private static People[] Load(string path)
{
var formatter = new XmlSerializer(typeof(People[]));
using var fs = new FileStream(path, FileMode.OpenOrCreate);
var peoples = (People[])formatter.Deserialize(fs);
return peoples;
}
private static void Save(string path, People[] peoples)
{
var formatter = new XmlSerializer(typeof(People[]));
using var fs = new FileStream(path, FileMode.OpenOrCreate);
formatter.Serialize(fs, peoples);
}
[Serializable]
public class People
{
public string LastName { get; set; }
public string Name { get; set; }
public int School { get; set; }
public int One { get; set; }
public int Two { get; set; }
}