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

2021-01-27 09:15

阅读:1203

标签:write   get   null   and   amp   cat   ref   prope   base   

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

标签:write   get   null   and   amp   cat   ref   prope   base   

原文地址:https://www.cnblogs.com/Fred1987/p/11946100.html


评论


亲,登录后才可以留言!