Public Overloads Shared Sub Initialize( _ ByVal licenseProdCode As Host.LicenseProductCode _ )
public static void Initialize( Host.LicenseProductCode licenseProdCode )
Parameters
- licenseProdCode
- the license product code.
Public Overloads Shared Sub Initialize( _ ByVal licenseProdCode As Host.LicenseProductCode _ )
public static void Initialize( Host.LicenseProductCode licenseProdCode )
| Exception | Description |
|---|---|
| System.Exception | Thrown when initialization fails. |
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.
/// <summary> /// The main entry point for the application, responsible for initializing the ArcGIS Core Host. /// </summary> /// <remarks>This method must be marked with the <see cref="STAThreadAttribute"/> to ensure proper /// threading model. It initializes the ArcGIS Core Host, which is required before constructing any objects from the /// ArcGIS.Core namespace. If initialization fails, an error message is displayed and the application /// exits.</remarks> /// <param name="args">Command-line arguments passed to the application.</param> //[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(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); } }
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)