Export (0) Print
Expand All
0 out of 3 rated this helpful - Rate this topic

ContentManager Constructor (IServiceProvider)

Initializes a new instance of ContentManager.

Namespace: Microsoft.Xna.Framework.Content
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public ContentManager (
         IServiceProvider serviceProvider


Type: IServiceProvider
The service provider that the ContentManager should use to locate services.
Exception typeCondition
ArgumentNullException The serviceProvider parameter is null.

When creating a new ContentManager, if no instance of Game is otherwise required by the application, it is often better to create a new class that implements the IServiceProvider interface rather than creating an instance of Game just to create a new instance of GraphicsDeviceManager.

By default, the ContentManager searches for content in the directory where the executable is located.

To create a ContentManager that uses Game.Services:

ContentManager contentManager = new ContentManager( Services );
Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.