How to pass a List to a method with parameter List?

后端 未结 4 1984
后悔当初
后悔当初 2021-01-05 23:53

I\'ve been away from inheritance for a while and need a little helping hand.

I have an abstract base class Chief. There are two inheriting classes

4条回答
  •  花落未央
    2021-01-06 00:32

    Here is my favorite trick

    public static void AssignRandomProperties(PSetList routeSettings, List theChiefs) 
        where T : Chief
    

    Then, you call like following

    AssignRandomProperties(s.Route, theVehicles);
    

提交回复
热议问题