This is used to retrieve the corresponding managed components by passing in the component ID.
Namespace:
ESRI.ArcGIS.Desktop.AddInsAssembly: ESRI.ArcGIS.Desktop.Addins (in ESRI.ArcGIS.Desktop.Addins.dll) Version: 10.0.0.0 (10.0.0.0)
Syntax
C# |
---|
public static T FromID<T>( string id ) |
Visual Basic (Declaration) |
---|
Public Shared Function FromID(Of T) ( _ id As String _ ) As T |
Visual C++ |
---|
public: generic<typename T> static T FromID( String^ id ) |
Parameters
- id
- Type: System..::.String
The component id.
Type Parameters
- T
Return Value
The managed component.Remarks
This method causes the appropriate function to load the corresponding components.
Examples
The example code below shows how to get the managed extension by passing in the component id.
CopyC#
private void GetManagedFromID() { // Extension1 is an add-in type within (or referenced by) this project. // No need to call FindExtension again. var ext = AddIn.FromID<Extension1>(ThisAddin.IDs.Extension1); ext.DoSomething(); //early bound. // An onDemand loading tool will be created here even OnClick hasn't been called var tool = AddIn.FromID<Tool1>(ThisAddin.IDs.Tool1); tool.DoSomething(ArcMap.Application.Caption); }
CopyVB.NET
Private Sub GetManagedFromID() ' Extension1 is an add-in type within (or referenced by) this project. ' No need to call FindExtension again. Dim ext = AddIn.FromID(Of Extension1)(ThisAddin.IDs.Extension1) ext.DoSomething() 'early bound. ' An onDemand loading tool will be created here even OnClick hasn't been called Dim tool = AddIn.FromID(Of Tool1)(ThisAddin.IDs.Tool1) tool.DoSomething(ArcMap.Application.Caption) End Sub End Class