/// <summary> /// Determines if the specified item's children should be reorganized. /// </summary> /// <param name="parent">The parent item.</param> /// <returns>True if the parent's children should be reorganized, otherwise false.</returns> private bool ShouldReorganizeChildren(BaseCodeItemElement parent) { // Enumeration values should never be reordered. if (parent is CodeItemEnum) { return false; } var parentAttributes = parent.Attributes; if (parentAttributes != null) { // Some attributes indicate that order is critical and should not be reordered. var attributesToIgnore = new[] { "System.Runtime.InteropServices.ComImportAttribute", "System.Runtime.InteropServices.StructLayoutAttribute" }; if (parentAttributes.OfType<CodeAttribute>().Any(x => attributesToIgnore.Contains(x.FullName))) { return false; } } return true; }