From 6d7b57c9f94594fec57e90c06c56fab33438245b Mon Sep 17 00:00:00 2001 From: Timerix Date: Sun, 11 Jan 2026 02:40:53 +0500 Subject: [PATCH] first time in my life i found a use case for HashSet --- Evil Calculator/EquationManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Evil Calculator/EquationManager.cs b/Evil Calculator/EquationManager.cs index ead73d9..877d5a7 100644 --- a/Evil Calculator/EquationManager.cs +++ b/Evil Calculator/EquationManager.cs @@ -2,6 +2,7 @@ { class EquationManager { + private static readonly HashSet _operators = new() { "+", "-", "*", "/", "^", "√" }; private ReverseNotationSolver reverseNotationSolver = new(); List equation = new(); @@ -173,11 +174,11 @@ outerOperandLabel.Text = currentOperand == "" ? "0" : currentOperand; } } - + private bool IsOperator() { if (equation.Count == 0) return false; - return new[] { "+", "-", "*", "/", "^", "√" }.Contains(equation.Last().value); + return _operators.Contains(equation.Last().value); } private bool IsOpen()