我找不到什么是错在这个代码和错误没有帮助我很多:无法将密钥<T>表达式转换为键入<T>?
public class Track<T> {
readonly List<Key<T>> _keys = new List<Key<T>>();
public void AddKey<T>(float time, T value) {
var key = new Key<T> {
Time = time,
Value = value
};
_keys.Add(key); // <== Error: cannot convert Key<T> expression to type Key<T>
}
}
public struct Key<T> {
public float Time;
public T Value;
}
很好的解释!谢谢! – mcmorry