G
Gab12345
Guest
- class Book {public string Titel;}
- class Novel : Book { }
- class ComicBook : Book { }
- list <Book> myBooks = new list<Book>(){
- new Novel {Titel="HP 1"},
- new Novel {Titel="HP2"},
- new Novel {Titel="HP3"},
- new ComicBook {Titel="Naruto"},
- new ComicBook {Titel="Naruto2"}
- }
- class Person {public string Name;}
- class Author : Person { }
- class Artist : Person { }
- List<Person> myPersons = new list(){
- new Author {Name = JK.Rawling}
- new Artist {Name = Masashi Kishimoto} }
I need to assign the property "Name = JK.Rawling" to some objects of "myBooks" list and "Name = Masashi Kishimoto" to other objects of "myBooks" list in order to have:
obj1 Novel {Titel = "HP1", Author.Name = JK.Rawling}
obj2 Novel {Titel = "HP2", Author.Name = JK.Rawling}
obj3 Novel {Titel = "HP3", Author.Name = JK.Rawling}
obj4 ComicBook {Titel = "Naruto", Artist.Name = Masashi Kishimoto}
obj5 ComicBook {Titel = "Naruto2", Artist.Name = Masashi Kishimoto}
Continue reading...