C# show Environment property info name and value retrieve, Maximize the Console Window based on window resolution

using System.Reflection;

static void ShowEnvironmentInfoDemo()
        {
            Type type = typeof(Environment);
            PropertyInfo[] pis = type.GetProperties();
            if (pis != null && pis.Any())
            {
                Parallel.ForEach(pis, x =>
                {
                    Console.WriteLine($"Name:{x.Name},value:{x.GetValue(x)}");
                });
            }
        }

 

  static void ConsoleWindowDemo()
        {
            try
            {
                Type type = typeof(Console);
                PropertyInfo[] pis = type.GetProperties();
                if (pis != null && pis.Any())
                {
                    Parallel.ForEach(pis, x =>
                    {
                        Console.WriteLine($"Name:{x.Name},Value:{x.GetValue(x)}");
                    });
                }
            }
            catch
            {

            }            
        }
static void MaximizeConsoleWindow()
        {
            Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);
        }

 

你可能感兴趣的:(C# show Environment property info name and value retrieve, Maximize the Console Window based on window resolution)