MsieJavaScriptEngine.JsRt.JavaScriptRuntime.Dispose C# (CSharp) Method

Dispose() public method

Disposes a runtime.
Once a runtime has been disposed, all resources owned by it are invalid and cannot be used. If the runtime is active (i.e. it is set to be current on a particular thread), it cannot be disposed.
public Dispose ( ) : void
return void
        public void Dispose()
        {
            if (IsValid)
            {
                Native.ThrowIfError(Native.JsDisposeRuntime(this));
            }

            _handle = IntPtr.Zero;
        }

Usage Example

        /// <summary>
        /// Destroys object
        /// </summary>
        /// <param name="disposing">Flag, allowing destruction of
        /// managed objects contained in fields of class</param>
        private void Dispose(bool disposing)
        {
            lock (_synchronizer)
            {
                if (!_disposed)
                {
                    _disposed = true;

                    _jsRuntime.Dispose();
                }
            }
        }