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

2022-10-12,,,,

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.doc》

下载本文的Word格式文档,以方便收藏与打印。