Table of Contents

Class ContentManager

Namespace
Microsoft.Xna.Framework.Content
Assembly
MonoGame.Framework.dll
public class ContentManager : IDisposable
Inheritance
ContentManager
Implements
Derived
Inherited Members

Constructors

ContentManager(IServiceProvider)

public ContentManager(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

ContentManager(IServiceProvider, string)

public ContentManager(IServiceProvider serviceProvider, string rootDirectory)

Parameters

serviceProvider IServiceProvider
rootDirectory string

Properties

LoadedAssets

Virtual property to allow a derived ContentManager to have it's assets reloaded

protected virtual Dictionary<string, object> LoadedAssets { get; }

Property Value

Dictionary<string, object>

RootDirectory

public string RootDirectory { get; set; }

Property Value

string

ServiceProvider

public IServiceProvider ServiceProvider { get; }

Property Value

IServiceProvider

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

~ContentManager()

protected ~ContentManager()

LoadLocalized<T>(string)

public virtual T LoadLocalized<T>(string assetName)

Parameters

assetName string

Returns

T

Type Parameters

T

Load<T>(string)

public virtual T Load<T>(string assetName)

Parameters

assetName string

Returns

T

Type Parameters

T

OpenStream(string)

protected virtual Stream OpenStream(string assetName)

Parameters

assetName string

Returns

Stream

ReadAsset<T>(string, Action<IDisposable>)

protected T ReadAsset<T>(string assetName, Action<IDisposable> recordDisposableObject)

Parameters

assetName string
recordDisposableObject Action<IDisposable>

Returns

T

Type Parameters

T

ReloadAsset<T>(string, T)

protected virtual void ReloadAsset<T>(string originalAssetName, T currentAsset)

Parameters

originalAssetName string
currentAsset T

Type Parameters

T

ReloadGraphicsAssets()

protected virtual void ReloadGraphicsAssets()

Unload()

public virtual void Unload()

UnloadAsset(string)

Unloads a single asset.

public virtual void UnloadAsset(string assetName)

Parameters

assetName string

The name of the asset to unload. This cannot be null.

UnloadAssets(IList<string>)

Unloads a set of assets.

public virtual void UnloadAssets(IList<string> assetNames)

Parameters

assetNames IList<string>

The names of the assets to unload.