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


ILayerFile Interface (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Carto)  

ILayerFile Interface

Provides access to members that control the reading and writing of layer document files.

Product Availability

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

Members

Description
Method Close Close the layer file.
Read-only property Filename The name of the layer file that the LayerFile coclass is linked to.
Read-only property IsLayerFile Indicates if the file is a valid layer file.
Read-only property IsPresent Indicates if the layer file is present.
Read-only property IsReadOnly Indicates if the layer file is read only.
Read-only property Layer The Layer object. If no layer object is stored in the layer file this returns NULL.
Method New Creates and opens a new layer File in preparation for the contents to be retrieve or updated.
Method Open Open the layer file in preparation for the contents to be retrieved or updated.
Method ReplaceContents Replace the contents of the layer file.
Method Save Save the contents of the layer file to the bound file.
Method SaveAs Save the contents of the layer file to the specified file name.
Read-only property Thumbnail The thumbnail stored in the layer file. If this is empty E_FAIL is returned.

CoClasses that implement ILayerFile

CoClasses and Classes Description
LayerFile The LayerFile coclass is used to read and write layer document files.

.NET Snippets

Save Layer To File | Set Group Layer Cache

.NET Samples

Save a layer file in a MapControl application (Code Files: SaveLayerFileCmd) | Route layer (Code Files: Program) | Working with packages in ArcGIS Engine (Code Files: FrmMapControl)

.NET Related Topics

How to save a layer file | How to setup, solve, and save a network analysis problem