Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2010-08-31 06:19:41 +0400
committerJamesNK <james@newtonking.com>2010-08-31 06:19:41 +0400
commit12a91cce9ee0f3675a8df44a9a204137c0b136b9 (patch)
tree88aeb3d70366cb4f07baa6aeda8b17a789322c34 /Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs
parent97d9cf82ef6c96254246bc2886251151ae17eeae (diff)
-Updated source code to VS2010
-Updated main project to .NET 4.0 -Updated to psake 4.0 -Changed assembly version to 4.0.0.0 -Added ICustomTypeDescriptor implementation to JObject, removed JTypeDescriptionProvider and JTypeDescriptor -Changed serialization of collections to use iterator rather than indexer -Removed Compact Framework project -Fixed XML documentation warnings
Diffstat (limited to 'Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs')
-rw-r--r--Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs18
1 files changed, 11 insertions, 7 deletions
diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs b/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs
index 24ff421..647b29a 100644
--- a/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs
@@ -33,7 +33,7 @@ using Newtonsoft.Json.Tests.TestObjects;
namespace Newtonsoft.Json.Tests.TestObjects
{
- public class VersionKeyedCollection : KeyedCollection<string, Person>, IList
+ public class VersionKeyedCollection : KeyedCollection<string, Person>, IEnumerable<Person>
{
public List<string> Messages { get; set; }
@@ -54,16 +54,20 @@ namespace Newtonsoft.Json.Tests.TestObjects
errorContext.Handled = true;
}
- object IList.this[int index]
+ IEnumerator<Person> IEnumerable<Person>.GetEnumerator()
{
- get
+ for (int i = 0; i < Count; i++)
{
- if (index % 2 == 0)
- throw new Exception("Index even: " + index);
+ if (i % 2 == 0)
+ throw new Exception("Index even: " + i);
- return this[index];
+ yield return this[i];
}
- set { this[index] = (Person)value; }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return ((IEnumerable<Person>) this).GetEnumerator();
}
}
} \ No newline at end of file