Show / Hide Table of Contents

# Class OrtEnv

This class initializes the process-global ONNX Runtime environment instance (OrtEnv)

##### Inheritance

System.Object
OrtEnv

###### Namespace: Microsoft.ML.OnnxRuntime

###### Assembly: cs.temp.dll.dll

##### Syntax

    public sealed class OrtEnv : SafeHandle

### Properties

#### EnvLogLevel

Get/Set log level property of OrtEnv instance

##### Declaration

    public LogLevel EnvLogLevel { get; set; }

##### Property Value

Type | Description
--- | ---
LogLevel | env log level

#### IsInvalid

Overrides SafeHandle.IsInvalid

##### Declaration

    public override bool IsInvalid { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | returns true if handle is equal to Zero

### Methods

#### CreateAndRegisterAllocator(OrtMemoryInfo, OrtArenaCfg)

Create and register an allocator to the OrtEnv instance so as to enable sharing across all sessions using the OrtEnv instance

OrtMemoryInfo instance to be used for allocator creation OrtArenaCfg instance that will be used to define the behavior of the arena based allocator

##### Declaration

    public void CreateAndRegisterAllocator(OrtMemoryInfo memInfo, OrtArenaCfg arenaCfg)

##### Parameters

Type | Name | Description
--- | --- | ---
OrtMemoryInfo | memInfo |
OrtArenaCfg | arenaCfg |

#### DisableTelemetryEvents()

Disable platform telemetry collection

##### Declaration

    public void DisableTelemetryEvents()

#### EnableTelemetryEvents()

Enable platform telemetry collection where applicable (currently only official Windows ORT builds have telemetry collection capabilities)

##### Declaration

    public void EnableTelemetryEvents()

#### GetAvailableProviders()

Queries all the execution providers supported in the native onnxruntime shared library

##### Declaration

    public string[] GetAvailableProviders()

##### Returns

Type | Description
--- | ---
System.String[] | an array of strings that represent execution provider names

#### Instance()

Returns an instance of OrtEnv It returns the same instance on every call - `OrtEnv` is singleton

##### Declaration

    public static OrtEnv Instance()

##### Returns

Type | Description
--- | ---
OrtEnv | Returns a singleton instance of OrtEnv that represents native OrtEnv object

#### ReleaseHandle()

Overrides SafeHandle.ReleaseHandle() to properly dispose of the native instance of OrtEnv

##### Declaration

    protected override bool ReleaseHandle()

##### Returns

Type | Description
--- | ---
System.Boolean | always returns true