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/TableDefinitionCollection.cs | 61 +++++----------------- 1 file changed, 14 insertions(+), 47 deletions(-) (limited to 'src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs') diff --git a/src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs b/src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs index 80303913..96c5f74f 100644 --- a/src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs +++ b/src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs @@ -36,18 +36,12 @@ namespace WixToolset.Data.WindowsInstaller /// Gets the number of items in the collection. /// /// Number of items in collection. - public int Count - { - get { return this.collection.Count; } - } + public int Count => this.collection.Count; /// /// Table definition collections are never read-only. /// - public bool IsReadOnly - { - get { return false; } - } + public bool IsReadOnly => false; /// /// Gets a table definition by name. @@ -72,10 +66,7 @@ namespace WixToolset.Data.WindowsInstaller /// Name of table to locate. /// Table definition if found. /// True if table definition was found otherwise false. - public bool TryGet(string tableName, out TableDefinition table) - { - return this.collection.TryGetValue(tableName, out table); - } + public bool TryGet(string tableName, out TableDefinition table) => this.collection.TryGetValue(tableName, out table); /// /// Load a table definition collection from an XmlReader. @@ -95,76 +86,52 @@ namespace WixToolset.Data.WindowsInstaller /// /// Table definition to add to the collection. /// Indexes by table definition name. - public void Add(TableDefinition tableDefinition) - { - this.collection.Add(tableDefinition.Name, tableDefinition); - } + public void Add(TableDefinition tableDefinition) => this.collection.Add(tableDefinition.Name, tableDefinition); /// /// Removes all table definitions from the collection. /// - public void Clear() - { - this.collection.Clear(); - } + public void Clear() => this.collection.Clear(); /// /// Checks if the collection contains a table name. /// /// The table to check in the collection. /// True if collection contains the table. - public bool Contains(string tableName) - { - return this.collection.ContainsKey(tableName); - } + public bool Contains(string tableName) => this.collection.ContainsKey(tableName); /// /// Checks if the collection contains a table. /// /// The table to check in the collection. /// True if collection contains the table. - public bool Contains(TableDefinition table) - { - return this.collection.ContainsKey(table.Name); - } + public bool Contains(TableDefinition table) => this.collection.ContainsKey(table.Name); /// /// Copies table definitions to an arry. /// /// Array to copy the table definitions to. /// Index in the array to start copying at. - public void CopyTo(TableDefinition[] array, int index) - { - this.collection.Values.CopyTo(array, index); - } + public void CopyTo(TableDefinition[] array, int index) => this.collection.Values.CopyTo(array, index); /// /// Removes a table definition from the collection. /// /// Table to remove from the collection. /// True if the table definition existed in the collection and was removed. - public bool Remove(TableDefinition table) - { - return this.collection.Remove(table.Name); - } + public bool Remove(TableDefinition table) => this.collection.Remove(table.Name); /// /// Gets enumerator for the collection. /// /// Enumerator for the collection. - public IEnumerator GetEnumerator() - { - return this.collection.Values.GetEnumerator(); - } + public IEnumerator GetEnumerator() => this.collection.Values.GetEnumerator(); /// /// Gets the untyped enumerator for the collection. /// /// Untyped enumerator for the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return this.collection.Values.GetEnumerator(); - } + IEnumerator IEnumerable.GetEnumerator() => this.collection.Values.GetEnumerator(); /// /// Loads a collection of table definitions from a XmlReader in memory. @@ -178,8 +145,8 @@ namespace WixToolset.Data.WindowsInstaller throw new XmlException(); } - bool empty = reader.IsEmptyElement; - TableDefinitionCollection tableDefinitionCollection = new TableDefinitionCollection(); + var empty = reader.IsEmptyElement; + var tableDefinitionCollection = new TableDefinitionCollection(); while (reader.MoveToNextAttribute()) { @@ -188,7 +155,7 @@ namespace WixToolset.Data.WindowsInstaller // parse the child elements if (!empty) { - bool done = false; + var done = false; while (!done && reader.Read()) { -- cgit v1.2.3-55-g6feb