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 worlds as a List<GwWorld>.
var allWorlds = wm.Worlds.ToList();
// Retreive one GwWorld by specifying the world name as a string.
var oneWorldFromString = wm.Worlds["Tarnished Coast'];
// Retrieve one GwWorld by specifying the worldId as an int
var oneWorldFromId = wm.Worlds;
Note: From an UI point of view a single retrieval of all worlds and then using the returned list is the recommended scenario.