From 2d81cae7943bc094215734840f1015d135771921 Mon Sep 17 00:00:00 2001 From: Hugh Bellamy Date: Thu, 28 Feb 2019 11:34:26 +0000 Subject: [PATCH] Remove ListViewItem/ColumnHeader dead code --- .../src/System/Windows/Forms/ColumnHeader.cs | 5 +---- .../src/System/Windows/Forms/ListViewItem.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ColumnHeader.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ColumnHeader.cs index b1c4e1415e8..3a40da6ee89 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ColumnHeader.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ColumnHeader.cs @@ -497,10 +497,7 @@ public ColumnHeaderImageListIndexer(ColumnHeader ch) { public override ImageList ImageList { get { - if (owner != null && owner.ListView != null) { - return owner.ListView.SmallImageList; - } - return null; + return owner.ListView?.SmallImageList; } set { Debug.Assert(false, "We should never set the image list"); diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ListViewItem.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ListViewItem.cs index b7cf6c6b50e..8cafa37ea91 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ListViewItem.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ListViewItem.cs @@ -1404,19 +1404,22 @@ public Rectangle Bounds { internal bool CustomBackColor { get { - return style != null && !style.backColor.IsEmpty; + Debug.Assert(style != null, "Should have checked CustomStyle"); + return !style.backColor.IsEmpty; } } internal bool CustomFont { get { - return style != null && style.font != null; + Debug.Assert(style != null, "Should have checked CustomStyle"); + return style.font != null; } } internal bool CustomForeColor { get { - return style != null && !style.foreColor.IsEmpty; + Debug.Assert(style != null, "Should have checked CustomStyle"); + return !style.foreColor.IsEmpty; } }