Enum StandardHandleInfo.StandardConsoleHandle
This enumeration defines the three valid values for an enumeration, StandardConsoleHandle, the input argument type of methods StandardHandleState and GetRedirectedFileName, both public methods, and GetStandardHandle, currently private, but under consideration for a promotion.
The upper and lower values are for efficient boundary testing.
Namespace: WizardWrx.ConsoleStreams
Assembly: WizardWrx.ConsoleStreams.dll
Syntax
public enum StandardConsoleHandle : int
Remarks
Although the standard handles have well-known fixed values, each OF WHICH HAS a corresponding symbolic constant defined in winbase.h, they are nonstandard handle values (all three less than zero), which would usually be interpreted as invalid handles. These values would be unusual, though perfectly legal, enumeration values.
Instead, I defined this enumeration, and provided a private method, GetStandardHandle, that maps the enumeration to the corresponding standard handle constant by way of a simple lookup table that uses the enumeration value, cast to integer, as its index. The returned Windows handle value is a 32 or 64 bit positive integer, which that function passes into GetStdHandle (via Platform Invoke), through which it returns.
This is one of two public enumerations that were ported from StandardHandleState.H, the C/C++ header that defines the interfaces that this class supersedes.
Fields
Name | Description |
---|---|
OutOfRange | This member is intended for bounds-checking values that are cast to an integral type. |
StandardError | This member signifies a request to perform an operation on the Standard Output stream, STDERR, which corresponds to the Console.Error and System.Diagnostics.Process.StandardError properties. |
StandardInput | This member signifies a request to perform an operation on the Standard Input stream, STDOUT, which corresponds to the Console.In and System.Diagnostics.Process.StandardInput properties. |
StandardOutput | This member signifies a request to perform an operation on the Standard Output stream, STDIN, which corresponds to the Console.Out and System.Diagnostics.Process.StandardOutput properties. |
Undefined | This member is both the uninitialized value of a variable of its type and the lower limit of the range of valid values. |