From 5390ea994aa575d0b31abd2d577fc6a278c851c6 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 19 Mar 2022 11:11:58 -0700 Subject: Minor code clean up --- .../WindowsInstaller/TableDefinitionCollection.cs | 47 +++++++++++++++++----- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs b/src/api/wix/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs index fcc2b1f6..522e3b84 100644 --- a/src/api/wix/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs +++ b/src/api/wix/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs @@ -14,7 +14,7 @@ namespace WixToolset.Data.WindowsInstaller { public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wi/tables"; - private Dictionary collection; + private readonly Dictionary collection; /// /// Instantiate a new TableDefinitionCollection class. @@ -74,59 +74,86 @@ 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) => this.collection.TryGetValue(tableName, out table); + public bool TryGet(string tableName, out TableDefinition table) + { + return this.collection.TryGetValue(tableName, out table); + } /// /// Adds a table definition to the collection. /// /// 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) => this.collection.ContainsKey(tableName); + public bool Contains(string tableName) + { + return 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) => this.collection.ContainsKey(table.Name); + public bool Contains(TableDefinition table) + { + return 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) => this.collection.Remove(table.Name); + public bool Remove(TableDefinition table) + { + return this.collection.Remove(table.Name); + } /// /// Gets enumerator for the collection. /// /// Enumerator for the collection. - public IEnumerator GetEnumerator() => this.collection.Values.GetEnumerator(); + public IEnumerator GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } /// /// Gets the untyped enumerator for the collection. /// /// Untyped enumerator for the collection. - IEnumerator IEnumerable.GetEnumerator() => this.collection.Values.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() + { + return this.collection.Values.GetEnumerator(); + } /// /// Loads a collection of table definitions from a XmlReader in memory. -- cgit v1.2.3-55-g6feb