C#泛型代码怎么修改?
void GetEntity()
{
if (this.Value == null)
this.Value = new T();
return new T();
}
一个泛型的问题?C#泛型代码怎么修改?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- threenewbee 2015-01-28 08:34关注
T GetEntity<T>() where T : class, new() { if (this.Value == null) this.Value = new T(); return this.Value; }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报