mscorlib(4.0.0.0) API with additions
System.AppContext Class Reference

Provides members for setting and retrieving data about an application's context. More...

Static Public Member Functions

static object GetData (string name)
 Returns the value of the named data element assigned to the current application domain. More...
 
static bool TryGetSwitch (string switchName, out bool isEnabled)
 Tries to get the value of a switch. More...
 
static void SetSwitch (string switchName, bool isEnabled)
 Sets the value of a switch. More...
 

Static Public Attributes

static string BaseDirectory => ((string)AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY")) ?? AppDomain.CurrentDomain.BaseDirectory
 Gets the pathname of the base directory that the assembly resolver uses to probe for assemblies. More...
 
static string TargetFrameworkName => AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
 Gets the name of the framework version targeted by the current application. More...
 

Detailed Description

Provides members for setting and retrieving data about an application's context.

Definition at line 6 of file AppContext.cs.

Member Function Documentation

◆ GetData()

static object System.AppContext.GetData ( string  name)
static

Returns the value of the named data element assigned to the current application domain.

Parameters
nameThe name of the data element.
Returns
The value of name , if name identifies a named value; otherwise, null.

Definition at line 32 of file AppContext.cs.

◆ SetSwitch()

static void System.AppContext.SetSwitch ( string  switchName,
bool  isEnabled 
)
static

Sets the value of a switch.

Parameters
switchNameThe name of the switch.
isEnabledThe value of the switch.
Exceptions
T:System.ArgumentNullExceptionswitchName is null.
T:System.ArgumentExceptionswitchName is F:System.String.Empty.

Definition at line 112 of file AppContext.cs.

◆ TryGetSwitch()

static bool System.AppContext.TryGetSwitch ( string  switchName,
out bool  isEnabled 
)
static

Tries to get the value of a switch.

Parameters
switchNameThe name of the switch.
isEnabledWhen this method returns, contains the value of switchName if switchName was found, or false if switchName was not found. This parameter is passed uninitialized.
Returns
true if switchName was set and the isEnabled argument contains the value of the switch; otherwise, false.
Exceptions
T:System.ArgumentNullExceptionswitchName is null.
T:System.ArgumentExceptionswitchName is F:System.String.Empty.

Definition at line 58 of file AppContext.cs.

Member Data Documentation

◆ BaseDirectory

string System.AppContext.BaseDirectory => ((string)AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY")) ?? AppDomain.CurrentDomain.BaseDirectory
static

Gets the pathname of the base directory that the assembly resolver uses to probe for assemblies.

Returns
the pathname of the base directory that the assembly resolver uses to probe for assemblies.

Definition at line 23 of file AppContext.cs.

◆ TargetFrameworkName

string System.AppContext.TargetFrameworkName => AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
static

Gets the name of the framework version targeted by the current application.

Returns
The name of the framework version targeted by the current application.

Definition at line 27 of file AppContext.cs.


The documentation for this class was generated from the following file: