public string GetWinner(string playerInfo) { // the players in this game, assume there are always only 2 var players = JsonConvert.DeserializeObject <List <Player> >(playerInfo); var winner = DeckService.DetermineWinner(players[0], players[1]); return($"Winner is {winner.PlayerName} with {AttributeUtil.GetAttributeValue<NameAttribute>(typeof(HandResult.HandResults), HandResult.DetermineHandResult(winner.PlayerHand).Item1.ToString(), nameof(NameAttribute.Name))}"); }
private string GetFieldDisplayName(string field) { return(AttributeUtil.GetAttributeValue( typeof(OneStepApplyVendorModel), field, typeof(NopResourceDisplayName), nameof(NopResourceDisplayName.DisplayName) ).ToString()); }
/// <summary> /// Gets the <see cref="EncodingNameAttribute.EncodingName"/> of the specific <see cref="CodePage"/>. /// </summary> /// <param name="cp"></param> /// <returns></returns> public static string GetEncodingName(CodePage cp) { return(AttributeUtil.GetAttributeValue(cp.GetType(), cp.ToString(), (EncodingNameAttribute ena) => ena.EncodingName)); }
public static string GetCultureName(CultureInfoId id) { return(AttributeUtil.GetAttributeValue(id.GetType(), id.ToString(), (CultInfoAttribute a) => a.CultureName)); }