C# Documenting Generic Usage

public class Car<TFirst,TSecond>
{
    
    
  public TFirst First {
    
     get; }
  public TSecond Second {
    
     get; }
  public Car(TFirst first, TSecond second) => (First, Second) = (first, second);
}
//传入类型和参数即可
 var benci = new Car<string,int>("奔驰",23);
        Debug.Log(benci.First+benci.Second);

Guess you like

Origin blog.csdn.net/weixin_42430280/article/details/131412201