Click or drag to resize

SelfHost Class

Version 130.1.90
SelfHost allows your application executable to be used as the BrowserSubProcess with minimal effort. https://github.com/cefsharp/CefSharp/wiki/SelfHost-BrowserSubProcess
Inheritance Hierarchy
SystemObject
  CefSharp.BrowserSubprocessSelfHost

Namespace: CefSharp.BrowserSubprocess
Assembly: CefSharp.Core (in CefSharp.Core.dll) Version: 129.0.110.0
Syntax
public class SelfHost

The SelfHost type exposes the following members.

Constructors
 NameDescription
Public methodSelfHostInitializes a new instance of the SelfHost class
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberMain This function should be called from the application entry point function (typically Program.Main) to execute a secondary process e.g. gpu, renderer, utility This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess it's preferable to use the Main method provided by this class. - Pass in command line args
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Example
//WinForms Example public class Program { [STAThread] public static int Main(string[] args) { var exitCode = CefSharp.BrowserSubprocess.SelfHost.Main(args); if (exitCode >= 0) { return exitCode; } var settings = new CefSettings(); //Absolute path to your applications executable settings.BrowserSubprocessPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; Cef.Initialize(settings); var browser = new BrowserForm(true); Application.Run(browser); return 0; } }
See Also