static class · System
Environment
public static class Environment
- Kind
- static class
- Namespace
- System
- Assembly
- System.Core
- Access
- public, static, abstract
- Source file
Runtime.ant
Inheritance
- Base classes
-
AnyEnvironment
Properties
str NewLine { get; }
#
Milliseconds from an arbitrary start (it only goes forward).
How many processors the program can run on.
The number of the thread that asks (1: the program's first).
Methods
The program's arguments (not its own name).
GetEnvironmentVariable(str name) : str?
#
An environment variable, or null when it is not set.
Private and internal members (8)
Inherited members (5)
GetTypemethod from AnyUndescribedmethod from AnyToStringmethod from AnyHashmethod from Anydestroymethod from Any
Source
Environment as Antril, decompiled from its Larva HIR.
// System.Environment — System.Core (decompiled from Larva HIR)
into namespace System
{
public static class Environment
{
extern("args.count") ArgumentCount() : i64;
extern("args.length") ArgumentLength(i64 index) : i64;
extern("args.unit") ArgumentUnit(i64 index, i64 at) : i64;
extern("env.get") VariableInto(u16[] name) : i64;
extern("env.unit") VariableUnit(i64 index) : i64;
extern("time.now") Now() : i64;
extern("cpu.count") Processors() : i64;
extern("thread.id") ThreadNumber() : i64;
public:
/// The program's arguments (not its own name).
GetCommandLineArgs() : List<str>
{
i64 count = ArgumentCount();
List<str> arguments = new List<str>((i32)count);
loop (i64 a = 0..count)
{
u16[] units = new u16[(i32)ArgumentLength(a)];
loop (i32 i = 0..units.Length)
units[i] = (u16)ArgumentUnit(a, i);
arguments.Add(Unicode.FromUtf16(units));
}
return arguments;
}
/// An environment variable, or null when it is not set.
GetEnvironmentVariable(str name) : str?
{
i64 length = VariableInto(Unicode.ToUtf16(name));
if (length < 0)
return null;
u16[] units = new u16[(i32)length];
loop (i32 i = 0..units.Length)
units[i] = (u16)VariableUnit(i);
return Unicode.FromUtf16(units);
}
str NewLine
{
get => "\n";
}
/// Milliseconds from an arbitrary start (it only goes forward).
i64 TickCount64
{
get => Now();
}
/// How many processors the program can run on.
i32 ProcessorCount
{
get => (i32)Processors();
}
/// The number of the thread that asks (1: the program's first).
i32 CurrentManagedThreadId
{
get => (i32)ThreadNumber();
}
}
}