c#

c#

c# – How to parse command line parameters in a console application and display help on them

Question: You need to write a console application in C# so that when you enter the run -h command, help is displayed with a description of the commands. static void Main(string[] args) { string command = string.Empty; if (args.Length != 0) { switch (args[0]) { case “-h”: help(); break; } …

c# – How to parse command line parameters in a console application and display help on them Read More »

c# – The principle of open / closed when determining the file type dynamically

Question: There is an application code in which it is necessary to dynamically determine the file type (HTML or TXT) by content and, depending on the received file type, call the appropriate processing algorithm. interface IFileType { void Process(); } class HtmlFile : IFileType { public void Process() { Console.WriteLine(“HTML”); …

c# – The principle of open / closed when determining the file type dynamically Read More »

Scroll to Top