C#泛型代码怎么修改?
void GetEntity()
{
if (this.Value == null)
this.Value = new T();
return new T();
}
T GetEntity<T>() where T : class, new()
{
if (this.Value == null)
this.Value = new T();
return this.Value;
}
GetEntity()
GetEntity《T》()
尖括号也发不了,只能用书名号了
void GetEntity<T>()
{
if (this.Value == null)
this.Value = default(T);
}