static class · System
Environment
public static class Environment
- Tipo
- static class
- Espacio de nombres
- System
- Ensamblado
- System.Core
- Acceso
- public, static, abstract
- Archivo fuente
Runtime.ant
Herencia
- Clases base
-
AnyEnvironment
Propiedades
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).
Métodos
The program's arguments (not its own name).
GetEnvironmentVariable(str name) : str?
#
An environment variable, or null when it is not set.
Miembros privados e internos (8)
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
Environment en Antril, descompilado a partir de su 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();
}
}
}