C# Iterative DFS
\npublic class Solution\n{\n    public bool IsSymmetric(TreeNode root)\n    {\n        if (root == null)\n        {\n            return true;\n        }\n\n    
```\npublic class Solution\n{\n    public bool IsSymmetric(TreeNode root)\n    {\n        if (root == null)\n        {\n            return true;\n        }\n\n        var stack = new Stack<(TreeNode, TreeNode)>();\n        stack.Push((root.left, root.right));\n\n        while (stack.Any())\n        {\n            switch (stack.Pop())\n            {\n                case (null, null):\n                    continue;\n\n                case (null, _) or (_, null):\n                    return false;\n\n                case (TreeNode l, TreeNode r) when l.val != r.val:\n                    return false;\n\n                case (TreeNode l, TreeNode r) when l.val == r.val:\n                    stack.Push((l.left, r.right));\n                    stack.Push((l.right, r.left));\n                    break;\n            }\n        }\n\n        return true;\n    }\n}\n```
['C#']