Skip to content

Commit fd4c97a

Browse files
committed
Use a struct enumerator for JsonObject
1 parent ff5c432 commit fd4c97a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

StyleCop.Analyzers/StyleCop.Analyzers/LightJson/JsonObject.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace LightJson
1616
[DebuggerTypeProxy(typeof(JsonObjectDebugView))]
1717
internal sealed class JsonObject : IEnumerable<KeyValuePair<string, JsonValue>>, IEnumerable<JsonValue>
1818
{
19-
private readonly IDictionary<string, JsonValue> properties;
19+
private readonly Dictionary<string, JsonValue> properties;
2020

2121
/// <summary>
2222
/// Initializes a new instance of the <see cref="JsonObject"/> class.
@@ -158,14 +158,23 @@ public bool ContainsKey(string key)
158158
/// <returns>Returns true if the value is found; otherwise, false.</returns>
159159
public bool Contains(JsonValue value)
160160
{
161-
return this.properties.Values.Contains(value);
161+
return this.properties.ContainsValue(value);
162162
}
163163

164164
/// <summary>
165165
/// Returns an enumerator that iterates through this collection.
166166
/// </summary>
167167
/// <returns>The enumerator that iterates through this collection.</returns>
168-
public IEnumerator<KeyValuePair<string, JsonValue>> GetEnumerator()
168+
public Dictionary<string, JsonValue>.Enumerator GetEnumerator()
169+
{
170+
return this.properties.GetEnumerator();
171+
}
172+
173+
/// <summary>
174+
/// Returns an enumerator that iterates through this collection.
175+
/// </summary>
176+
/// <returns>The enumerator that iterates through this collection.</returns>
177+
IEnumerator<KeyValuePair<string, JsonValue>> IEnumerable<KeyValuePair<string, JsonValue>>.GetEnumerator()
169178
{
170179
return this.properties.GetEnumerator();
171180
}

0 commit comments

Comments
 (0)