Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Read from a List using LINQ
    primarykey
    data
    text
    <p>So I know there is a lot of questions asked on this same exact question, and there are a lot of great answers but still I can't seem to fix my own problem with my code. So I will GREATLY appreciate anything anyone has to offer. I really feel like I have tried everything and I just have no idea what the problem may be. I have been working on this forever. I want to Read from the List and write it to the Console. But When I try to write it it is blank.</p> <pre><code>public class Admin { public void Maine() { List&lt;Books&gt; myLibraryBooks = new List&lt;Books&gt;(); Books book1 = new Books(); Console.Write("Enter Author Name:"); book1.Author = Console.ReadLine(); Console.Write("Enter Book Title:"); book1.Title = Console.ReadLine(); Console.Write("Enter Book ISBN:"); book1.ISBN = Console.ReadLine(); Console.Write("Enter the Publish Date:"); book1.Publish_Date = Console.ReadLine(); myLibraryBooks.Add(new Books() { Author = book1.Author.ToUpper(), Title = book1.Title.ToUpper(), ISBN = book1.ISBN, Publish_Date = book1.Publish_Date.ToUpper() }); Console.WriteLine("Book added Successfully"); Console.Write("Enter Author's Name:"); string input_to_find = Console.ReadLine(); var author = from Authors in myLibraryBooks where Authors.Author == input_to_find select Authors; foreach (var book in author) { Console.WriteLine(book.Author, book.Title, book.ISBN, book.Publish_Date); } class Books { public string Author { get; set; } public string Title { get; set; } public string ISBN { get; set; } public string Publish_Date { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload