public static void Initialize( Host.LicenseProductCode licenseProdCode )
Public Overloads Shared Sub Initialize( _ ByVal licenseProdCode As Host.LicenseProductCode _ )
Parameters
- licenseProdCode
- the license product code.
public static void Initialize( Host.LicenseProductCode licenseProdCode )
Public Overloads Shared Sub Initialize( _ ByVal licenseProdCode As Host.LicenseProductCode _ )
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.
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); } }
Target Platforms: Windows 11, Windows 10