This document is archived and information here might be outdated.  Recommended version.


ILayerFactoryHelper.CreateLayersFromName Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Carto)  

ILayerFactoryHelper.CreateLayersFromName Method

Given a name attempts to open it using the layer factories, if successful returns a layers enumerator.

[Visual Basic .NET]
Public Function CreateLayersFromName ( _
    ByVal Name As IName _
) As IEnumLayer
[C#]
public IEnumLayer CreateLayersFromName (
    IName Name
);
[C++]
HRESULT CreateLayersFromName(
  IName* Name,
  IEnumLayer** Layer
);
[C++]

Parameters Name [in]
Name is a parameter of type IName Layer [out, retval]
Layer is a parameter of type IEnumLayer

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Use this method to create a data Layer or Layers from an IName object. Each IName  instance is passed to CreateLayersFromName to return an enumerator of layers containing a new instance of each layer.

This is typically used for drag and drop. For example, if a feature layer is dragged from an ArcCatalog application and dropped onto the MapControl or PageLayoutControl, objects implementing IName can be extracted from the drop using the IName DataObjectHelper.

Remarks

The CreateLayersFromName method is of limited use to ArcGIS Engine and ArcGIS for Server developers because there is only a small subset of layer factories present and registered in the 'Layer Factory' component category. The CreateLayersFromName method internally iterates the objects in the "Layer Factory" component category and uses the ILayerFactory::CanCreate and ILayerFactory::Create methods.

See Also

ILayerFactoryHelper Interface

.NET Related Topics

How to add different types of layers to a map | How to drop data onto the MapControl