ArcGIS Pro 2.9 API Reference Guide
Initialize(LicenseProductCode) Method
Example 

ArcGIS.Core.Hosting Namespace > Host Class > Initialize Method : Initialize(LicenseProductCode) Method
the license product code.
Call to initialize a Core Objects host process. The method must be called before constructing any objects from ArcGIS.CoreObjects library.
Syntax
public static void Initialize( 
   Host.LicenseProductCode licenseProdCode
)
Public Overloads Shared Sub Initialize( _
   ByVal licenseProdCode As Host.LicenseProductCode _
) 

Parameters

licenseProdCode
the license product code.
Exceptions
ExceptionDescription
Thrown when initialization fails.
Remarks
The following conditions must all be met to successfully Initialize CoreHost: If Initialization fails, a System.Exception will be thrown. The message property will contain the reason

Note: An ArcGIS Pro license can either be checked out (i.e. disconnected) or the 'sign me in automatically' check box is checked on the ArcGIS Pro login popup. To disconnect your license, run ArcGIS Pro, go to the Backstage, Licensing Tab.

Example
using ArcGIS.Core.Data;
//There must be a reference to ArcGIS.CoreHost.dll
using ArcGIS.Core.Hosting;

class Program {
    //[STAThread] must be present on the Application entry point
    [STAThread]
    static void Main(string[] args) {

        //Call Host.Initialize before constructing any objects from ArcGIS.Core
        try {
            Host.Initialize();
        }
        catch (Exception e) {
            // Error (missing installation, no license, 64 bit mismatch, etc.)
            Console.WriteLine(string.Format("Initialization failed: {0}",e.Message));
            return;
        }

        //if we are here, ArcGIS.Core is successfully initialized
        Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\Data\SDK\GDB\MySampleData.gdb")));
        IReadOnlyList<TableDefinition> definitions = gdb.GetDefinitions<FeatureClassDefinition>();

        foreach (var fdsDef in definitions) {
            Console.WriteLine(TableString(fdsDef as TableDefinition));
        }
        Console.Read();
    }

    private static string TableString(TableDefinition table) {
        string alias = table.GetAliasName();
        string name = table.GetName();
        return string.Format("{0} ({1})", alias.Length > 0 ? alias : name, name);
    }

}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

Host Class
Host Members
Overload List