diff options
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r-- | Xamarin.Forms.Core/TemplateUtilities.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Xamarin.Forms.Core/TemplateUtilities.cs b/Xamarin.Forms.Core/TemplateUtilities.cs index 4a8d21b9..e78f4836 100644 --- a/Xamarin.Forms.Core/TemplateUtilities.cs +++ b/Xamarin.Forms.Core/TemplateUtilities.cs @@ -58,9 +58,9 @@ namespace Xamarin.Forms var newElement = (Element)newValue; if (self.ControlTemplate == null) { - for (var i = 0; i < self.InternalChildren.Count; i++) + while (self.InternalChildren.Count > 0) { - self.InternalChildren.Remove(self.InternalChildren[i]); + self.InternalChildren.RemoveAt(self.InternalChildren.Count - 1); } if (newValue != null) @@ -104,9 +104,9 @@ namespace Xamarin.Forms } // Now remove all remnants of any other children just to be sure - for (var i = 0; i < self.InternalChildren.Count; i++) + while (self.InternalChildren.Count > 0) { - self.InternalChildren.Remove(self.InternalChildren[i]); + self.InternalChildren.RemoveAt(self.InternalChildren.Count - 1); } ControlTemplate template = self.ControlTemplate; |