Thanks much Dominique! There may be a better way for me to have done this since I don't know coding very well, but it seems to be working for the most part. For anyone else who may face this issue, I defined a variable for my map service of type ArcGISDynamicMapServiceLayer and then found a line of code on another forum to add only visible layers of the service to the LayerIDs value, as follows:
ArcGISDynamicMapServiceLayer shorelineAssessmentMapperMapLayer = (ArcGISDynamicMapServiceLayer)ShorelineAssessmentMapperMap.Layers[3];
ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.MapPoint;
ESRI.ArcGIS.Client.Tasks.IdentifyParameters identifyParams = new IdentifyParameters()
{
Geometry = clickPoint,
MapExtent = ShorelineAssessmentMapperMap.Extent,
Width = (int)ShorelineAssessmentMapperMap.ActualWidth,
Height = (int)ShorelineAssessmentMapperMap.ActualHeight,
LayerOption = LayerOption.all,
SpatialReference = ShorelineAssessmentMapperMap.SpatialReference,
};
foreach (int x in shorelineAssessmentMapperMapLayer.VisibleLayers)
identifyParams.LayerIds.Add(x);
IdentifyTask identifyTask = new IdentifyTask(shorelineAssessmentMapperMapLayer.Url);
identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
identifyTask.Failed += IdentifyTask_Failed;
identifyTask.ExecuteAsync(identifyParams);