45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System.Collections;
|
|
namespace BenchMarkDotnetStudy.BenchmarkDemo
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Console.WriteLine("Benchmark 基准测试示例");
|
|
if (args?.Length > 0)
|
|
{
|
|
Console.WriteLine($"命令行参数有{args.Length}个,分别是[{string.Join(" | ", args)}]");
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("没有命令行参数");
|
|
}
|
|
|
|
var allEnvs = Environment.GetEnvironmentVariables();
|
|
|
|
var defaultColor = Console.ForegroundColor;
|
|
foreach (DictionaryEntry item in allEnvs)
|
|
{
|
|
if (item.Key.ToString().Contains("DOTNET_"))
|
|
{
|
|
Console.ForegroundColor = ConsoleColor.Blue;
|
|
Console.Write($"Key = ");
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
Console.Write($"{item.Key}, ");
|
|
|
|
Console.ForegroundColor = ConsoleColor.Blue;
|
|
Console.Write($"Value = ");
|
|
|
|
Console.ForegroundColor = ConsoleColor.Green;
|
|
Console.Write($"{item.Value}");
|
|
|
|
Console.Write($"{Environment.NewLine}");
|
|
}
|
|
|
|
}
|
|
Console.ForegroundColor = defaultColor;
|
|
|
|
}
|
|
}
|
|
} |