title: LINQ for beginners
body: <p>I love C#, I love the framework, and I also love to learn as much as possible. Today I began to read articles about LINQ in C# and I couldn't find anything good for a beginner that never worked with SQL in his life.</p>
  
  <p>I found <a href="http://www.programmersheaven.com/2/CSharp3-4" rel="nofollow noreferrer">this</a> article very helpful and I understood small parts of it, but I'd like to get more examples.</p>
  
  <p>After reading it couple of times, I tried to use LINQ in a function of mine, but I failed.</p>
  
  <pre><code>    private void Filter(string filename)
      {
          using (TextWriter writer = File.CreateText(Application.StartupPath + "\\temp\\test.txt"))
          {
              using(TextReader reader = File.OpenText(filename))
              {
                  string line;
                  while((line = reader.ReadLine()) != null)
                  {
                      string[] items = line.Split('\t');
                      int myInteger = int.Parse(items[1]);
                      if (myInteger == 24809) writer.WriteLine(line); 
                  }
              }
          }
      }
  </code></pre>
  
  <p>This is what I did and it did not work, the result was always false.</p>
  
  <pre><code>    private void Filter(string filename)
      {
          using (TextWriter writer = File.CreateText(Application.StartupPath + "\\temp\\test.txt"))
          {
              using(TextReader reader = File.OpenText(filename))
              {
                  string line;
                  while((line = reader.ReadLine()) != null)
                  {
                      string[] items = line.Split('\t');
                      var Linqi = from item in items
                                  where int.Parse(items[1]) == 24809
                                  select true;
                      if (Linqi == true) writer.WriteLine(line); 
                  }
              }
          }
      }
  </code></pre>
  
  <p>I'm asking for two things:</p>
  
  <ol>
  <li>How would the function look like using as much Linq as possible?</li>
  <li>A website/book/article about Linq,but please note I'm a decent beginner in sql/linq.</li>
  </ol>
  
  <p>Thank you in advance!</p>