码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2019-11-27 23:08:44      阅读:64      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!