Конвертирование некоторых элементов коллекции - C#
Формулировка задачи:
Подскажите, как и в каком месте кода преобразовать только необходимые переменные из типа string в int? В arguments[3], [5]-[10] ругается на "неявное преобразование типа "string" в "int""
var collection = new List<subscribes>();
using (StreamReader reader=File.OpenText("1.txt"))
{
while (!reader.EndOfStream)
{
string str = reader.ReadLine();
string[] arguments = str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
var item = new subscribes
{
surname = arguments[0],
name = arguments[1],
patronymic = arguments[2],
phone = arguments[3],
street = arguments[4],
home = arguments[5],
apartment = arguments[6],
pay = arguments[7],
costone = arguments[8],
time = arguments[9],
balance = arguments[10]
};
collection.Add(item);
}
}
return collection;
}Решение задачи: «Конвертирование некоторых элементов коллекции»
textual
Листинг программы
phone = int.Parse(arguments[3]),