I'm to see if a layer exists and remove it if it exists. The layer would have
been saved as a temporary resource. Here is the code.  

// get the map
MgMap map = new MgMap(siteConnection);
map.Open(mgMapName);
        
MgLayerCollection layerCol = map.GetLayers();
        
if(layerCol.Contains("myLayer"))
{
     layerCol.Remove("myLayer");
}
        
.... Add myLayer code here .....

I get the following error whether or not the layer exists:

 Compiler Error Message: CS1502: The best overloaded method match for
'OSGeo.MapGuide.MgLayerCollection.Remove(OSGeo.MapGuide.MgLayerBase)' has
some invalid arguments

Source Error:

Line 42:        if(layerCol.Contains("myLayer"))
Line 43:        {
Line 44:                layerCol.Remove("myLayer");
Line 45:        }
Line 46:        

Anyone have any suggestions?

Thanks in advance.

alex
-- 
View this message in context: 
http://www.nabble.com/Remove-layer-C--tf4388428s16610.html#a12511956
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to