C#-在子类中指定超类的类型参数?

问题描述 投票:1回答:1

我正在尝试在C#中执行以下操作。

public class Parent<T> where T : Parent<???>
{
  public T Prop { get; set; }
}

public class Child : Parent<Child>
{
}

我该怎么办?

c# generics inheritance type-parameter
1个回答
1
投票

这很好用:

© www.soinside.com 2019 - 2024. All rights reserved.