Retrieve maps from the API

To retrieve maps you first have to create a new instance of the WorldManager class. The WorldManager manages all relevant object and ensures that the cached data is used.

The WorldManager resides in the GW2DotNET.V1.World namespace. Create a new instance of the WorldManger class with the following code:
GW2DotNET.V1.World.WorldManager wm = new GW2DotNET.V1.World.WorldManager(); 

Note: You can also add the GW2DotNET.V1.World namespace to your using directives.

To retrieve the worlds you have three possibilities.
// Retrieve all maps as a List<GwMap>
var allMaps = wm.Maps.ToList();

// Retrieve one GwMap by specifying a map name.
var oneMapFromString = wm.["Queensdale"];

//Retrive one GwMap by specifying a mapIf
var oneMapFromId = wm.[28]; 


Note: From an UI point of view a single retrieval of all maps and then using the returned list is the recommended scenario.

Last edited May 28, 2013 at 5:41 PM by Ruhrpottpatriot, version 2