Show / Hide Table of Contents

    Class SystemProperties

    Helper for environment variables. This class helps to convert the environment variables to int or bool data types and also silently handles read permission errors.

    For instructions how to set environment variables for your OS, see https://www.schrodinger.com/kb/1842.

    Note that if you want to load any of these settings for your application from a configuration file, it is recommended your application load them at startup and call SetProperty(String, String) to set them.

    Set the environment variable lucene.ignoreSecurityExceptions to false to change the read behavior of these methods to throw the underlying exception instead of returning the default value.

    Inheritance
    System.Object
    SystemProperties
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public static class SystemProperties : object

    Methods

    | Improve this Doc View Source

    GetProperty(String)

    Retrieves the value of an environment variable from the current process.

    Declaration
    public static string GetProperty(string key)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    Returns
    Type Description
    System.String

    The environment variable value.

    | Improve this Doc View Source

    GetProperty(String, String)

    Retrieves the value of an environment variable from the current process, with a default value if it doens't exist or the caller doesn't have permission to read the value.

    Declaration
    public static string GetProperty(string key, string defaultValue)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    System.String defaultValue

    The value to use if the environment variable does not exist or the caller doesn't have permission to read the value.

    Returns
    Type Description
    System.String

    The environment variable value.

    | Improve this Doc View Source

    GetPropertyAsBoolean(String)

    Retrieves the value of an environment variable from the current process as . If the value cannot be cast to , returns false.

    Declaration
    public static bool GetPropertyAsBoolean(string key)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    Returns
    Type Description
    System.Boolean

    The environment variable value.

    | Improve this Doc View Source

    GetPropertyAsBoolean(String, Boolean)

    Retrieves the value of an environment variable from the current process as , with a default value if it doens't exist, the caller doesn't have permission to read the value, or the value cannot be cast to a .

    Declaration
    public static bool GetPropertyAsBoolean(string key, bool defaultValue)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    System.Boolean defaultValue

    The value to use if the environment variable does not exist, the caller doesn't have permission to read the value, or the value cannot be cast to .

    Returns
    Type Description
    System.Boolean

    The environment variable value.

    | Improve this Doc View Source

    GetPropertyAsInt32(String)

    Retrieves the value of an environment variable from the current process as . If the value cannot be cast to , returns 0.

    Declaration
    public static int GetPropertyAsInt32(string key)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    Returns
    Type Description
    System.Int32

    The environment variable value.

    | Improve this Doc View Source

    GetPropertyAsInt32(String, Int32)

    Retrieves the value of an environment variable from the current process as , with a default value if it doens't exist, the caller doesn't have permission to read the value, or the value cannot be cast to a .

    Declaration
    public static int GetPropertyAsInt32(string key, int defaultValue)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    System.Int32 defaultValue

    The value to use if the environment variable does not exist, the caller doesn't have permission to read the value, or the value cannot be cast to .

    Returns
    Type Description
    System.Int32

    The environment variable value.

    | Improve this Doc View Source

    SetProperty(String, String)

    Creates, modifies, or deletes an environment variable stored in the current process.

    Declaration
    public static void SetProperty(string key, string value)
    Parameters
    Type Name Description
    System.String key

    The name of the environment variable.

    System.String value

    The new environment variable value.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)