Browse Source

Replace C# if statement with switch statement to match GDScript (#5018)

hpnrep6 4 years ago
parent
commit
783f295af2
1 changed files with 11 additions and 7 deletions
  1. 11 7
      getting_started/workflow/best_practices/data_preferences.rst

+ 11 - 7
getting_started/workflow/best_practices/data_preferences.rst

@@ -257,14 +257,18 @@ tree structures.
 
         public override void Notification(int what)
         {
-            if (what == NotificationPredelete)
+            switch (what)
             {
-                foreach (object child in _children)
-                {
-                    TreeNode node = child as TreeNode;
-                    if (node != null)
-                        node.Free();
-                }
+                case NotificationPredelete:
+                    foreach (object child in _children)
+                    {
+                        TreeNode node = child as TreeNode;
+                        if (node != null)
+                            node.Free();
+                    }
+                    break;
+                default:
+                    break;
             }
         }
     }