✅ How can I improve this code? - C#