From df8f367c7bc515be7f5652338f1e64e6a9e6acd8 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 5 Feb 2020 14:36:35 -0800 Subject: Code cleanup --- .../WindowsInstaller/TableIndexedCollection.cs | 62 +++++----------------- 1 file changed, 12 insertions(+), 50 deletions(-) (limited to 'src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs') diff --git a/src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs b/src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs index 57ba19d1..a399c6fa 100644 --- a/src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs +++ b/src/WixToolset.Data/WindowsInstaller/TableIndexedCollection.cs @@ -15,19 +15,13 @@ namespace WixToolset.Data.WindowsInstaller /// /// Instantiate a new empty collection. /// - public TableIndexedCollection() - { - this.collection = new Dictionary(); - } + public TableIndexedCollection() => this.collection = new Dictionary(); /// /// Instantiate a new collection populated with a set of tables. /// /// Set of tables. - public TableIndexedCollection(IEnumerable tables) - { - this.collection = tables.ToDictionary(t => t.Name); - } + public TableIndexedCollection(IEnumerable
tables) => this.collection = tables.ToDictionary(t => t.Name); /// /// Gets the number of items in the collection. @@ -45,18 +39,12 @@ namespace WixToolset.Data.WindowsInstaller /// /// Table to add to the collection. /// Indexes the table by name. - public void Add(Table table) - { - this.collection.Add(table.Name, table); - } + public void Add(Table table) => this.collection.Add(table.Name, table); /// /// Clear the tables from the collection. /// - public void Clear() - { - this.collection.Clear(); - } + public void Clear() => this.collection.Clear(); /// /// Determines if a table is in the collection. @@ -70,46 +58,31 @@ namespace WixToolset.Data.WindowsInstaller /// /// Array to copy the collection into. /// Index to start copying from. - public void CopyTo(Table[] array, int arrayIndex) - { - this.collection.Values.CopyTo(array, arrayIndex); - } + public void CopyTo(Table[] array, int arrayIndex) => this.collection.Values.CopyTo(array, arrayIndex); /// /// Remove a table from the collection by name. /// /// Table name to remove from the collection. - public void Remove(string tableName) - { - this.collection.Remove(tableName); - } + public void Remove(string tableName) => _ = this.collection.Remove(tableName); /// /// Remove a table from the collection. /// /// Table with matching name to remove from the collection. - public bool Remove(Table table) - { - return this.collection.Remove(table.Name); - } + public bool Remove(Table table) => this.collection.Remove(table.Name); /// /// Gets an enumerator over the whole collection. /// /// Collection enumerator. - public IEnumerator
GetEnumerator() - { - return this.collection.Values.GetEnumerator(); - } + public IEnumerator
GetEnumerator() => this.collection.Values.GetEnumerator(); /// /// Gets an untyped enumerator over the whole collection. /// /// Untyped collection enumerator. - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.collection.Values.GetEnumerator(); - } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => this.collection.Values.GetEnumerator(); /// /// Gets a table by name. @@ -117,16 +90,8 @@ namespace WixToolset.Data.WindowsInstaller /// Name of table to locate. public Table this[string tableName] { - get - { - Table table; - return this.collection.TryGetValue(tableName, out table) ? table : null; - } - - set - { - this.collection[tableName] = value; - } + get => this.collection.TryGetValue(tableName, out var table) ? table : null; + set => this.collection[tableName] = value; } /// @@ -135,9 +100,6 @@ namespace WixToolset.Data.WindowsInstaller /// Table name to locate. /// Found table. /// True if table with table name was found, otherwise false. - public bool TryGetTable(string tableName, out Table table) - { - return this.collection.TryGetValue(tableName, out table); - } + public bool TryGetTable(string tableName, out Table table) => this.collection.TryGetValue(tableName, out table); } } -- cgit v1.2.3-55-g6feb