public static SentenseWorker GetInstanse(string content) { if (instance == null) { instance = new SentenseWorker(content); } return(instance); }
static void Main(string[] args) { Console.WriteLine("Input text or file path:"); string lineFromConsole = Console.ReadLine(); if (File.Exists(lineFromConsole)) { lineFromConsole = File.ReadAllText(lineFromConsole); } SentenseWorker sworker = SentenseWorker.GetInstanse(lineFromConsole); sworker.Do(); Console.WriteLine(sworker.Text); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Input text or file path:"); string lineFromConsole = Console.ReadLine(); if (File.Exists(lineFromConsole)) { lineFromConsole = File.ReadAllText(lineFromConsole); //обработка того, что файл для только чтения } SentenseWorker sworker = SentenseWorker.GetInstanse(lineFromConsole); sworker.Do(); Console.WriteLine(sworker.Text); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); }