I am learning ArcGIS javascript API and wanted to make a reordering panel for my webapp. I looked through the ArcGIS sample.
http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/layers_dynamic_reorder.html

but I'm stuck at addLake() function. If I'm understand the sample correctly, to add the new lake layer 
1. get the existing DynamicLayerInfos from the current map
2. create a new DynamicLayerInfo for the new layer
3. push to the DynamicLayerInfos
4. set the new DynamicLayerInfos to the map

The example uses LayerDataSource that reference a table as the new data source for the layer.

And how do you add a new layer from a public layer on a MapServer/FeatureServer. Can someone give me an example?