ПИбд-23 Тихоненков А.Е. Лабораторная №6 #14

Closed
YourDax wants to merge 2 commits from Lab6 into Lab5
2 changed files with 11 additions and 6 deletions
Showing only changes of commit 3914bd51bb - Show all commits

View File

@ -130,7 +130,7 @@ namespace AntiAircraftGun.Generics
foreach (var zenit in _collection.GetZenits())
{
// TODO: Получение объекта
T? obj = zenit;
if (obj != null)

View File

@ -129,11 +129,16 @@ namespace AntiAircraftGun.Generics
{
return false;
}
using FileStream fs = new(filename, FileMode.Create);
byte[] info = new
UTF8Encoding(true).GetBytes($"CarStorage{Environment.NewLine}{data}");
fs.Write(info, 0, info.Length);
return true;
string toWrite = $"CarStorage{Environment.NewLine}{data}";
var strs = toWrite.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
using (StreamWriter sw = new(filename))
{
foreach (var str in strs)
{
sw.WriteLine(str);
}
}
return true;
}
/// <summary>
/// Загрузка информации по автомобилям в хранилище из файла