fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ClassLibrary1
  7. {
  8. public class Class1
  9. {
  10. string FileName;
  11.  
  12. public Class1()
  13. {
  14. FileName = "";
  15. }
  16. public bool ReadFile(string st)
  17. {
  18. try
  19. {
  20. if (System.IO.Path.GetExtension(st).ToLower() != ".txt") return false;
  21. if (System.IO.File.Exists(st)) FileName = st; else return false;
  22. return true;
  23. }
  24. catch { return false; }
  25. }
  26. public void ViewFile()
  27. {
  28. if ("" == FileName) return;
  29. string Text = System.IO.File.ReadAllText(FileName,Encoding.GetEncoding(932));//932:Shift-Jis
  30. Console.WriteLine(Text);
  31. }
  32. }
  33. }
  34.  
  35.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
error CS5001: Program `prog.exe' does not contain a static `Main' method suitable for an entry point
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty