Skip to content

Commit

Permalink
WithBaseView of PatterMachesClass
Browse files Browse the repository at this point in the history
  • Loading branch information
urmasa-tar committed Aug 2, 2024
1 parent 57a4936 commit 8e80af2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
8 changes: 4 additions & 4 deletions PatternMatching/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace PatternMatching
{
public class Book
{
public string Title;
public string Author;
public uint PublishedYear;
public uint ISBN;
public string Title { get; set; } = "NoName";
public string Author { get; set; } = "";
public uint PublishedYear { get; set; } = 0;
public uint ISBN { get; set; } = 0;

public Book(string Title, string Author,uint Year, uint ISBN)
{
Expand Down
22 changes: 21 additions & 1 deletion PatternMatching/LibraryClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,27 @@ public void RemoveBook(int isbn)
}
}

List<Book> SearchBooks(string searchTerm) { return new List<Book>(); }
List<Book> SearchBooks(string searchTerm)
{
List<Book> result = new List<Book>();

/*
foreach (Book book in this.booksInLib)
{
if (book is Book { Title: searchTerm })
{
result.Add(book);
}
}
*/

return result;
}
/*
int GetId(string name, string autor) => (id) switch
{
(this.booksInLib., )
}
*/
}
}
2 changes: 1 addition & 1 deletion PatternMatching/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static void Main(string[] args)
{
LibraryClass mainObj = new LibraryClass();


}

}
Expand Down

0 comments on commit 8e80af2

Please sign in to comment.