var culture = CultureInfo.CreateSpecificCulture("en-us");
var resourceManager = new ResourceManager("UI.Languages.Messages", typeof(UI).Assembly);
Console.WriteLine(resourceManager.GetString("Hello", culture));
<EmbeddedResource Include="Languages\Messages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
</EmbeddedResource>
[{"Name":"Bob","Gender":{"Name":"M"},"BirthDate":"1999-02-22T00:00:00","Weight":80,"Height":180,"Age":34}]
private List<User> GetUsersData()
{
var res = Load<List<User>>(USERS_FILE_NAME);
pr(res.First());
Environment.Exit(500);
return res;
}
protected void pr<T>(T item)
{
Console.Write(item); // TEst 34 - 'это дефолтные значения аксессоров модели User
Environment.Exit(500);
}
private List<User> GetUsersData()
{
return Load<List<User>>(USERS_FILE_NAME) ?? new List<User>();
}
protected T Load<T>(string fileName)
{
if(File.Exists(fileName)) {
string data = File.ReadAllText(fileName);
return JsonSerializer.Deserialize<T>(data);
} else return default(T)!;
}
string data = File.ReadAllText(fileName); // [{"Name":"Bob","Gender":{"Name":"M"},"BirthDate":"1999-02-22T00:00:00","Weight":80,"Height":180,"Age":24}]
return JsonSerializer.Deserialize<T>(data); // А здесь уже создаётся новый объект с пустыми полями