c# - Remove duplicated code - using Action -


I have the following code, which is clearly some duplicate I'm sure it removed by using a delegate or action But it does not quite understand it.

Has anyone got any ideas?

  Public Zero DealStartingCards () {for (Int i = 0; I & lt; 3; i ++) {Foreign player (different players in player) {if (player.Hand.FaceDownCard .count & lt; 3) {if (deck.kount> gt;) player.hand.facesdowncards .Add (Deck.TakeTopCard ()); }}} For (int i = 0; i  

Inhard Cards, FaceIoper Cards and Facedown Cards are all types of list & lt; Cards & gt;

  Private zero-defect card (funk & lieutenant; hand, list & amp;;; Gt; hand projection) {To: "post-less" itemprop = "text"> 

(int i = 0; i gt; 0) {cards.Add (Deck.TakeTopCard ()); }}}}} Public Zero DealStartingCards () {DealCards (Hand = & gt; Hand. FaceDownCards); DealCard (hand = & gt; hands.faceupcard); DealCard (Hand => Hand. Inhard Cards); }

(It is assuming that player.Hand is hand - definitely adjust otherwise, of course.)


Comments