c# - Accessing the out parameter of a Function when it is invoked through a Func -


sorry I did not do very well with the title of the question, hopefully it will be apparenent with some code < / P>

I have created a class that stores poker hand information as follows

  Public class BestHandSummary & lt; T & gt; {Public Func & lt; T, bool & gt; Test {received; Set; } Public Ranking Rank {get; Set; } // Enum: Nothing, afternoon, straight, flush, poker: In the ascending order the public int receives the bestcard { Set; } Public Besthand (Ranking R) {Rank = R; } .. ///default ctor} I started the rule collection in the order of the most valuable hand, when I took the first () of the matched rules, chose the most powerful hand As the best hand will be  
  Rules = New list & lt; BesthandSamuri & lt; PokerHand & gt; & Gt; () {New BesthandSamuri & lt; PokerHand & gt; {Test = h = & gt; H. Hand Containsfoff (best out of the card), Rank = Ranking.ForoffCand, BestCard = Bestcard, New BesthandSmaller & lt; PokerHand & gt; {Test = h = & gt; H.HandContainsFlush (), Rank = Ranking.flush}, New Besthand Score & lt; PokerHand & gt; {Test = h = & gt; H. HAND CONTAINTHAND (Out of the best card), Rank = Ranking Simple, Bestcard = Bestcard}, New Besthand Comes & lt; PokerHand & gt; {Test = h = & gt; H.HandContainsTwoPair (Best Card Out), Rank = Ranking. Straightforward, bestcard = best card};}; Private Besthand Summi & lt; PokerHand & gt; GetAPlayersBestHand (poker hand arm) {bool is other = rules Any (R => R Test (hand)); If (hayeni) {returns rule Where (R = & gt; RT (hand) == true). first (); } New Best Hand SUMMARY & lt; PokerHand & gt; (Ranking nothing); }   

I do not know how can I tunnel the best card in BestHandSummary class Bestcard property? The above code is not working, Bestcard = Bestcard is not assigned to, which I can understand, but I am thinking that if there is a small change then I can fix it ..

  int bestcard; New Best Hand & lt; PokerHand & gt; {Test = h = & gt;  HandContainsFourOfakind  was never called because this code will not work, because  HandContainsFourOfakind  was never called, and therefore  best card  Nothing was assigned to.  

I am only interested in good cards when the rules are found. It is used when there is a draw between two players. E.G. H = 22 kJ - & gt; The best card is jack, not the king

So, you want to specify the bestcard only when test is implemented is? This will happen.

  var hands = new besthandt & lt; PokerHand & gt; {Rank = ranking.phorphicand}; hand. Test = H = & gt; {Int bestcard; Located in the area of ​​Lambda, // var is local = h.HandContainsFourOfAKind (best card out); hand. Bestcard = Best Card; Returns are included; };    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -