Retrieve events from the API
To retrieve events 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 two possibilities.
// Retrieve all worlds as a List<GwWorld>.
var allEvents = wm.Events.ToList();
// You can also retrieve a list of events filtered by a world.
// To do this you need to pass a GwWorld object to the events property
GwWorld world = new GwWorld(1018"Northern Shiverpeaks");
var eventsFilteredByWorld = wm.Events[world].ToList();