欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-26 21:47:40
using System.Reflection; static void ShowEnvironmentInfoDemo() { Type type = typeof(Environment); PropertyInfo[] pis = type.GetProperties(); if (pis !... ......
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);
        }