19
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
List<string> Titles= new List<string>(new string[] { "title1", "title2", "title3" });
9
List<Book> Books = new List<Book>{new Book{Title = Titles[0], Author = string.Empty}, new Book{Title = Titles[1], Author = string.Empty}, new Book{Title = Titles[2], Author = string.Empty}};
10
// ^ заменить предыдущую строку ^ //
11
Console.WriteLine(Books[0].Title);
12
}
13
}
14
15
public class Book
16
{
17
public string Title { get; set; }
18
public string Author { get; set; }
19
}
Cached Result