aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs')
-rw-r--r--src/WixToolset.Data/WindowsInstaller/TableDefinitionCollection.cs61
1 files changed, 14 insertions, 47 deletions
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
36 /// Gets the number of items in the collection. 36 /// Gets the number of items in the collection.
37 /// </summary> 37 /// </summary>
38 /// <value>Number of items in collection.</value> 38 /// <value>Number of items in collection.</value>
39 public int Count 39 public int Count => this.collection.Count;
40 {
41 get { return this.collection.Count; }
42 }
43 40
44 /// <summary> 41 /// <summary>
45 /// Table definition collections are never read-only. 42 /// Table definition collections are never read-only.
46 /// </summary> 43 /// </summary>
47 public bool IsReadOnly 44 public bool IsReadOnly => false;
48 {
49 get { return false; }
50 }
51 45
52 /// <summary> 46 /// <summary>
53 /// Gets a table definition by name. 47 /// Gets a table definition by name.
@@ -72,10 +66,7 @@ namespace WixToolset.Data.WindowsInstaller
72 /// <param name="tableName">Name of table to locate.</param> 66 /// <param name="tableName">Name of table to locate.</param>
73 /// <param name="table">Table definition if found.</param> 67 /// <param name="table">Table definition if found.</param>
74 /// <returns>True if table definition was found otherwise false.</returns> 68 /// <returns>True if table definition was found otherwise false.</returns>
75 public bool TryGet(string tableName, out TableDefinition table) 69 public bool TryGet(string tableName, out TableDefinition table) => this.collection.TryGetValue(tableName, out table);
76 {
77 return this.collection.TryGetValue(tableName, out table);
78 }
79 70
80 /// <summary> 71 /// <summary>
81 /// Load a table definition collection from an XmlReader. 72 /// Load a table definition collection from an XmlReader.
@@ -95,76 +86,52 @@ namespace WixToolset.Data.WindowsInstaller
95 /// </summary> 86 /// </summary>
96 /// <param name="tableDefinition">Table definition to add to the collection.</param> 87 /// <param name="tableDefinition">Table definition to add to the collection.</param>
97 /// <value>Indexes by table definition name.</value> 88 /// <value>Indexes by table definition name.</value>
98 public void Add(TableDefinition tableDefinition) 89 public void Add(TableDefinition tableDefinition) => this.collection.Add(tableDefinition.Name, tableDefinition);
99 {
100 this.collection.Add(tableDefinition.Name, tableDefinition);
101 }
102 90
103 /// <summary> 91 /// <summary>
104 /// Removes all table definitions from the collection. 92 /// Removes all table definitions from the collection.
105 /// </summary> 93 /// </summary>
106 public void Clear() 94 public void Clear() => this.collection.Clear();
107 {
108 this.collection.Clear();
109 }
110 95
111 /// <summary> 96 /// <summary>
112 /// Checks if the collection contains a table name. 97 /// Checks if the collection contains a table name.
113 /// </summary> 98 /// </summary>
114 /// <param name="tableName">The table to check in the collection.</param> 99 /// <param name="tableName">The table to check in the collection.</param>
115 /// <returns>True if collection contains the table.</returns> 100 /// <returns>True if collection contains the table.</returns>
116 public bool Contains(string tableName) 101 public bool Contains(string tableName) => this.collection.ContainsKey(tableName);
117 {
118 return this.collection.ContainsKey(tableName);
119 }
120 102
121 /// <summary> 103 /// <summary>
122 /// Checks if the collection contains a table. 104 /// Checks if the collection contains a table.
123 /// </summary> 105 /// </summary>
124 /// <param name="table">The table to check in the collection.</param> 106 /// <param name="table">The table to check in the collection.</param>
125 /// <returns>True if collection contains the table.</returns> 107 /// <returns>True if collection contains the table.</returns>
126 public bool Contains(TableDefinition table) 108 public bool Contains(TableDefinition table) => this.collection.ContainsKey(table.Name);
127 {
128 return this.collection.ContainsKey(table.Name);
129 }
130 109
131 /// <summary> 110 /// <summary>
132 /// Copies table definitions to an arry. 111 /// Copies table definitions to an arry.
133 /// </summary> 112 /// </summary>
134 /// <param name="array">Array to copy the table definitions to.</param> 113 /// <param name="array">Array to copy the table definitions to.</param>
135 /// <param name="index">Index in the array to start copying at.</param> 114 /// <param name="index">Index in the array to start copying at.</param>
136 public void CopyTo(TableDefinition[] array, int index) 115 public void CopyTo(TableDefinition[] array, int index) => this.collection.Values.CopyTo(array, index);
137 {
138 this.collection.Values.CopyTo(array, index);
139 }
140 116
141 /// <summary> 117 /// <summary>
142 /// Removes a table definition from the collection. 118 /// Removes a table definition from the collection.
143 /// </summary> 119 /// </summary>
144 /// <param name="table">Table to remove from the collection.</param> 120 /// <param name="table">Table to remove from the collection.</param>
145 /// <returns>True if the table definition existed in the collection and was removed.</returns> 121 /// <returns>True if the table definition existed in the collection and was removed.</returns>
146 public bool Remove(TableDefinition table) 122 public bool Remove(TableDefinition table) => this.collection.Remove(table.Name);
147 {
148 return this.collection.Remove(table.Name);
149 }
150 123
151 /// <summary> 124 /// <summary>
152 /// Gets enumerator for the collection. 125 /// Gets enumerator for the collection.
153 /// </summary> 126 /// </summary>
154 /// <returns>Enumerator for the collection.</returns> 127 /// <returns>Enumerator for the collection.</returns>
155 public IEnumerator<TableDefinition> GetEnumerator() 128 public IEnumerator<TableDefinition> GetEnumerator() => this.collection.Values.GetEnumerator();
156 {
157 return this.collection.Values.GetEnumerator();
158 }
159 129
160 /// <summary> 130 /// <summary>
161 /// Gets the untyped enumerator for the collection. 131 /// Gets the untyped enumerator for the collection.
162 /// </summary> 132 /// </summary>
163 /// <returns>Untyped enumerator for the collection.</returns> 133 /// <returns>Untyped enumerator for the collection.</returns>
164 IEnumerator IEnumerable.GetEnumerator() 134 IEnumerator IEnumerable.GetEnumerator() => this.collection.Values.GetEnumerator();
165 {
166 return this.collection.Values.GetEnumerator();
167 }
168 135
169 /// <summary> 136 /// <summary>
170 /// Loads a collection of table definitions from a XmlReader in memory. 137 /// Loads a collection of table definitions from a XmlReader in memory.
@@ -178,8 +145,8 @@ namespace WixToolset.Data.WindowsInstaller
178 throw new XmlException(); 145 throw new XmlException();
179 } 146 }
180 147
181 bool empty = reader.IsEmptyElement; 148 var empty = reader.IsEmptyElement;
182 TableDefinitionCollection tableDefinitionCollection = new TableDefinitionCollection(); 149 var tableDefinitionCollection = new TableDefinitionCollection();
183 150
184 while (reader.MoveToNextAttribute()) 151 while (reader.MoveToNextAttribute())
185 { 152 {
@@ -188,7 +155,7 @@ namespace WixToolset.Data.WindowsInstaller
188 // parse the child elements 155 // parse the child elements
189 if (!empty) 156 if (!empty)
190 { 157 {
191 bool done = false; 158 var done = false;
192 159
193 while (!done && reader.Read()) 160 while (!done && reader.Read())
194 { 161 {