1.获得文件名称;
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Layer File|*.lyr|All Files|*.*";
saveFileDialog.Title = "Create Layer File";
saveFileDialog.RestoreDirectory = true;
saveFileDialog.FileName = System.IO.Path.Combine(saveFileDialog.InitialDirectory,
layer.Name + ".lyr");
//Show the dialog box.
DialogResult dr = saveFileDialog.ShowDialog();
2.初始化LayerFileClass的示例;
//Create a new LayerFile instance.
ILayerFile layerFile = new LayerFileClass();
//Create a new layer file.
layerFile.New(saveFileDialog.FileName);
3.绑定Layer内容;
//Bind the layer file with the layer from the map.
layerFile.ReplaceContents(layer);
4.保存。
layerFile.Save();