public ValidNeighbors(RulesGraph rules, LinkedListNode <string> node) { try { var ball = rules[node.Value]; _result = ball.Balls.First(o => o.Name == node.Next.Value) != null; } catch (KeyNotFoundException) { _result = true; } catch (Exception) { _result = false; } }
public ValidNeighbors(RulesGraph rules, LinkedListNode<string> node) { try { var ball = rules[node.Value]; if (!ball.Balls.Any()) _result = true; else _result = ball.Balls.FirstOrDefault(o => o.Name == node.Next.Value) != null; } catch (KeyNotFoundException) { _result = true; } catch (NullReferenceException) { _result = true; } catch (Exception) { _result = false; } }
public ValidNeighbors(RulesGraph rules, LinkedListNode<string> node) { try { var ball = rules[node.Value]; _result = ball.Balls.First(o => o.Name == node.Next.Value) != null; } catch (KeyNotFoundException) { _result = true; } catch (Exception) { _result = false; } }