ArcGIS Pro 2.7 API Reference Guide
LayerFactory Class
Members  Example 

ArcGIS.Desktop.Mapping Namespace : LayerFactory Class
Provides static methods to create layers
Object Model
LayerFactory ClassLayer ClassFeatureLayer ClassGroupLayer ClassMosaicLayer ClassBasicRasterLayer ClassILayerFactory Interface
Syntax
public class LayerFactory : ILayerFactory  
Public Class LayerFactory 
   Implements ILayerFactory 
Example
Create and add a layer to the active map.
      /*
* string url = @"c:\data\project.gdb\DEM";  //Raster dataset from a FileGeodatabase
* string url = @"c:\connections\mySDEConnection.sde\roads";  //FeatureClass of a SDE
* string url = @"c:\connections\mySDEConnection.sde\States\roads";  //FeatureClass within a FeatureDataset from a SDE
* string url = @"c:\data\roads.shp";  //Shapefile
* string url = @"c:\data\imagery.tif";  //Image from a folder
* string url = @"c:\data\mySDEConnection.sde\roads";  //.lyrx or .lpkx file
* string url = @"c:\data\CAD\Charlottesville\N1W1.dwg\Polyline";  //FeatureClass in a CAD dwg file
* string url = @"C:\data\CAD\UrbanHouse.rvt\Architectural\Windows"; //Features in a Revit file
* string url = @"http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer";  //map service
* string url = @"http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0";  //FeatureLayer off a map service or feature service
*/
      string url = @"c:\data\project.gdb\roads";  //FeatureClass of a FileGeodatabase

      Uri uri = new Uri(url);
      await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map));
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Mapping.LayerFactory

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayerFactory Members
ArcGIS.Desktop.Mapping Namespace