The method Loadcan be used to download a large number of different types of content, including things such as images and sounds. Therefore, it can return instances of different types (for example, yours Texture2dand Effect).
, . -, , Object, .NET XNA .
public object Load(string path) { /*...*/}
:
Texture2D texture = (Texture2D)Content.Load("Textures//Road");
- . , . :
public T Load<T>(string path)
{
return (T)Load(path);
}
, ( , T) .
, , - ,
public Texture2d LoadTexture2d(string path)
{
return (Texture2d)Load(path);
}
public Effect LoadEffect(string path)
{
return (Effect)Load(path);
}
//500 more versions omitted for brevity