-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathEnvironmentPolyfill.cs
More file actions
46 lines (46 loc) · 886 Bytes
/
EnvironmentPolyfill.cs
File metadata and controls
46 lines (46 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// <auto-generated />
#pragma warning disable
namespace Polyfills;
using System;
using System.Diagnostics;
static partial class Polyfill
{
static int processId;
extension(Environment)
{
/// <summary>
/// Gets the unique identifier for the current process.
/// </summary>
public static int ProcessId
{
get
{
if (processId == 0)
{
using var process = Process.GetCurrentProcess();
processId = process.Id;
}
return processId;
}
}
}
static string? processPath;
extension(Environment)
{
/// <summary>
/// Gets the path of the executable that started the currently executing process.
/// </summary>
public static string? ProcessPath
{
get
{
if (processPath is null)
{
using var process = Process.GetCurrentProcess();
processPath = process.MainModule?.FileName;
}
return processPath;
}
}
}
}