title: How to print a text file using C#
body: <p>How can I print a text file in C#? In a console application.</p>
  
  <p>This is what I've found: <a href="http://msdn.microsoft.com/en-us/library/aa287530%28v=vs.71%29.aspx" rel="nofollow noreferrer">msdn sample</a> and this <a href="https://stackoverflow.com/questions/1472153/print-a-txt-to-the-default-printer-with-c-sharp">stackoverflow:answer is the msdn sample</a></p>
  
  <p>The code from the links are for windows forms applications, and does'nt work in an console appliction.</p>
  
  <p>Here is what I've found:</p>
  
  <pre><code>    string fileName = @"C:\data\stuff.txt";
          ProcessStartInfo startInfo;
          startInfo = new ProcessStartInfo(fileName);
  
          if (File.Exists(fileName))
          {
              int i = 0;
              foreach (String verb in startInfo.Verbs)
              {
                  // Display the possible verbs.
                  Console.WriteLine("  {0}. {1}", i.ToString(), verb);
                  i++;
              }
          }
  
          startInfo.Verb = "print";
          Process.Start(startInfo);
  </code></pre>
  
  <p>Since you say this question is off topic and not relevant here is a link to what I'm trying to learn: <a href="http://msdn.microsoft.com/library/vstudio/hh156542" rel="nofollow noreferrer">This is documentation of the .Net framework</a> and this is why I'm asking the question, I'm trying to learn about the various uses of .Net classes.</p>