I am a vb dev trying to understand c# syntax. If I want to call a function from main (should I be doing this) how would I do it? Here is my code:
Thanks!Code:namespace parsetxt { /// <summary> /// Summary description for Class1. /// </summary> class Class1 { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { string parsed = parseIt("lease.txt"); // // TODO: Add code to start application here // } public string parseIt(string fl) { // Read the file as one string. System.IO.StreamReader myFile = new System.IO.StreamReader(fl); string myString = myFile.ReadToEnd(); myFile.Close(); // Display the file contents. Console.WriteLine(myString); // Suspend the screen. Console.ReadLine(); } } }




Reply With Quote