aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/wix/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs47
1 files changed, 37 insertions, 10 deletions
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
14 { 14 {
15 public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wi/tables"; 15 public const string XmlNamespaceUri = "http://wixtoolset.org/schemas/v4/wi/tables";
16 16
17 private Dictionary<string, TableDefinition> collection; 17 private readonly Dictionary<string, TableDefinition> collection;
18 18
19 /// <summary> 19 /// <summary>
20 /// Instantiate a new TableDefinitionCollection class. 20 /// Instantiate a new TableDefinitionCollection class.
@@ -74,59 +74,86 @@ namespace WixToolset.Data.WindowsInstaller
74 /// <param name="tableName">Name of table to locate.</param> 74 /// <param name="tableName">Name of table to locate.</param>
75 /// <param name="table">Table definition if found.</param> 75 /// <param name="table">Table definition if found.</param>
76 /// <returns>True if table definition was found otherwise false.</returns> 76 /// <returns>True if table definition was found otherwise false.</returns>
77 public bool TryGet(string tableName, out TableDefinition table) => this.collection.TryGetValue(tableName, out table); 77 public bool TryGet(string tableName, out TableDefinition table)
78 {
79 return this.collection.TryGetValue(tableName, out table);
80 }
78 81
79 /// <summary> 82 /// <summary>
80 /// Adds a table definition to the collection. 83 /// Adds a table definition to the collection.
81 /// </summary> 84 /// </summary>
82 /// <param name="tableDefinition">Table definition to add to the collection.</param> 85 /// <param name="tableDefinition">Table definition to add to the collection.</param>
83 /// <value>Indexes by table definition name.</value> 86 /// <value>Indexes by table definition name.</value>
84 public void Add(TableDefinition tableDefinition) => this.collection.Add(tableDefinition.Name, tableDefinition); 87 public void Add(TableDefinition tableDefinition)
88 {
89 this.collection.Add(tableDefinition.Name, tableDefinition);
90 }
85 91
86 /// <summary> 92 /// <summary>
87 /// Removes all table definitions from the collection. 93 /// Removes all table definitions from the collection.
88 /// </summary> 94 /// </summary>
89 public void Clear() => this.collection.Clear(); 95 public void Clear()
96 {
97 this.collection.Clear();
98 }
90 99
91 /// <summary> 100 /// <summary>
92 /// Checks if the collection contains a table name. 101 /// Checks if the collection contains a table name.
93 /// </summary> 102 /// </summary>
94 /// <param name="tableName">The table to check in the collection.</param> 103 /// <param name="tableName">The table to check in the collection.</param>
95 /// <returns>True if collection contains the table.</returns> 104 /// <returns>True if collection contains the table.</returns>
96 public bool Contains(string tableName) => this.collection.ContainsKey(tableName); 105 public bool Contains(string tableName)
106 {
107 return this.collection.ContainsKey(tableName);
108 }
97 109
98 /// <summary> 110 /// <summary>
99 /// Checks if the collection contains a table. 111 /// Checks if the collection contains a table.
100 /// </summary> 112 /// </summary>
101 /// <param name="table">The table to check in the collection.</param> 113 /// <param name="table">The table to check in the collection.</param>
102 /// <returns>True if collection contains the table.</returns> 114 /// <returns>True if collection contains the table.</returns>
103 public bool Contains(TableDefinition table) => this.collection.ContainsKey(table.Name); 115 public bool Contains(TableDefinition table)
116 {
117 return this.collection.ContainsKey(table.Name);
118 }
104 119
105 /// <summary> 120 /// <summary>
106 /// Copies table definitions to an arry. 121 /// Copies table definitions to an arry.
107 /// </summary> 122 /// </summary>
108 /// <param name="array">Array to copy the table definitions to.</param> 123 /// <param name="array">Array to copy the table definitions to.</param>
109 /// <param name="index">Index in the array to start copying at.</param> 124 /// <param name="index">Index in the array to start copying at.</param>
110 public void CopyTo(TableDefinition[] array, int index) => this.collection.Values.CopyTo(array, index); 125 public void CopyTo(TableDefinition[] array, int index)
126 {
127 this.collection.Values.CopyTo(array, index);
128 }
111 129
112 /// <summary> 130 /// <summary>
113 /// Removes a table definition from the collection. 131 /// Removes a table definition from the collection.
114 /// </summary> 132 /// </summary>
115 /// <param name="table">Table to remove from the collection.</param> 133 /// <param name="table">Table to remove from the collection.</param>
116 /// <returns>True if the table definition existed in the collection and was removed.</returns> 134 /// <returns>True if the table definition existed in the collection and was removed.</returns>
117 public bool Remove(TableDefinition table) => this.collection.Remove(table.Name); 135 public bool Remove(TableDefinition table)
136 {
137 return this.collection.Remove(table.Name);
138 }
118 139
119 /// <summary> 140 /// <summary>
120 /// Gets enumerator for the collection. 141 /// Gets enumerator for the collection.
121 /// </summary> 142 /// </summary>
122 /// <returns>Enumerator for the collection.</returns> 143 /// <returns>Enumerator for the collection.</returns>
123 public IEnumerator<TableDefinition> GetEnumerator() => this.collection.Values.GetEnumerator(); 144 public IEnumerator<TableDefinition> GetEnumerator()
145 {
146 return this.collection.Values.GetEnumerator();
147 }
124 148
125 /// <summary> 149 /// <summary>
126 /// Gets the untyped enumerator for the collection. 150 /// Gets the untyped enumerator for the collection.
127 /// </summary> 151 /// </summary>
128 /// <returns>Untyped enumerator for the collection.</returns> 152 /// <returns>Untyped enumerator for the collection.</returns>
129 IEnumerator IEnumerable.GetEnumerator() => this.collection.Values.GetEnumerator(); 153 IEnumerator IEnumerable.GetEnumerator()
154 {
155 return this.collection.Values.GetEnumerator();
156 }
130 157
131 /// <summary> 158 /// <summary>
132 /// Loads a collection of table definitions from a XmlReader in memory. 159 /// Loads a collection of table definitions from a XmlReader in memory.