【发布时间】:2014-03-28 23:03:54
【问题描述】:
我有一个问题: 我正在尝试:
private struct QueuedFile
{
public Type t;
public object LoadedFile;
public string path;
public bool loaded;
public ContentManager c;
public QueuedFile(string path, Type t, ContentManager c)
{
this.t = t;
this.path = path;
LoadedFile = null;
loaded = false;
this.c = c;
}
public void Load()
{
LoadedFile = c.Load<this.t>(path); //<--ERROR: <this.t>
loaded = true;
}
}
但这给了我一个错误。有谁知道如何为以下方法保存变量 T:
public T LoadFileByType<T>(string path);
【问题讨论】:
标签: c# function variables types