await QueuedTask.Run(() =>
{
String[] fields = new string[] { "Type" }; //field to be used to retrieve unique values
CIMPointSymbol pointSym = SymbolFactory.Instance.ConstructPointSymbol(
ColorFactory.Instance.GreenRGB, 16.0, SimpleMarkerStyle.Pushpin); //constructing a point symbol as a template symbol
CIMSymbolReference symbolPointTemplate = pointSym.MakeSymbolReference();
//constructing renderer definition for unique value renderer
UniqueValueRendererDefinition uniqueValueRendererDef = new UniqueValueRendererDefinition(fields, symbolPointTemplate);
//creating a unique value renderer
var flyr = MapView.Active.GetSelectedLayers()[0] as FeatureLayer;
CIMUniqueValueRenderer uniqueValueRenderer = (CIMUniqueValueRenderer)flyr.CreateRenderer(uniqueValueRendererDef);
//setting the renderer to the feature layer
flyr.SetRenderer(uniqueValueRenderer);
});