The feature layer can be used to display features from one single layer of either a Feature Service or a Map Service. The layer can be either a (spatial) layer or a (non-spatial) table. The features in a FeatureLayer can be edited if it is based on a Feature Service. If the layer supports attachment, the layerDetails (or tableDetails) "hasAttachment" property will be true. If the feature layer is editable and has attachment, you can also add and delete attachments.
if (layer is DynamicMapServiceLayer) { // do something to apply to all subclasses } //as opposed to writing if (layer is ArcGISDynamicMapServiceLayer || layer is ArcGISImageServiceLayer || layer is ArcIMSMapServiceLayer || layer is GPResultImageLayer || layer is WMSLayer) { // do the same thing }