diff --git a/Build/build.ps1 b/Build/build.ps1 index aeeee77e..344f52c1 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -11,6 +11,7 @@ $buildNuGet = $true $treatWarningsAsErrors = $false $workingName = if ($workingName) {$workingName} else {"Working"} + $dnvmVersion = "1.0.0-beta8-15530" $baseDir = resolve-path .. $buildDir = "$baseDir\Build" @@ -93,7 +94,7 @@ task Package -depends Build { if ($nugetPrelease -ne $null) { $nugetVersion = $nugetVersion + "-" + $nugetPrelease - } + } New-Item -Path $workingDir\NuGet -ItemType Directory @@ -210,8 +211,8 @@ function DnxBuild($build) { $name = $build.Name - exec { dnvm install 1.0.0-beta8-15120 -r clr -u | Out-Default } - exec { dnvm use 1.0.0-beta8-15120 -r clr | Out-Default } + exec { dnvm install $dnvmVersion -r clr -u | Out-Default } + exec { dnvm use $dnvmVersion -r clr | Out-Default } Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host @@ -240,8 +241,8 @@ function DnxTests($build) #Write-Host #exec { & $toolsDir\Kvm\kvm.ps1 upgrade -r CoreCLR -NoNative | Out-Default } - exec { dnvm install 1.0.0-beta8-15120 -r coreclr -u | Out-Default } - exec { dnvm use 1.0.0-beta8-15120 -r coreclr | Out-Default } + exec { dnvm install $dnvmVersion -r coreclr -u | Out-Default } + exec { dnvm use $dnvmVersion -r coreclr | Out-Default } Write-Host -ForegroundColor Green "Restoring packages for $name" Write-Host diff --git a/Src/Newtonsoft.Json/Linq/JContainer.cs b/Src/Newtonsoft.Json/Linq/JContainer.cs index a705b577..f99d88d3 100644 --- a/Src/Newtonsoft.Json/Linq/JContainer.cs +++ b/Src/Newtonsoft.Json/Linq/JContainer.cs @@ -227,7 +227,11 @@ namespace Newtonsoft.Json.Linq /// public override JToken First { - get { return ChildrenTokens.FirstOrDefault(); } + get + { + IList children = ChildrenTokens; + return (children.Count > 0) ? children[0] : null; + } } /// @@ -238,7 +242,12 @@ namespace Newtonsoft.Json.Linq /// public override JToken Last { - get { return ChildrenTokens.LastOrDefault(); } + get + { + IList children = ChildrenTokens; + int count = children.Count; + return (count > 0) ? children[count - 1] : null; + } } /// @@ -349,16 +358,18 @@ namespace Newtonsoft.Json.Linq internal virtual void InsertItem(int index, JToken item, bool skipParentCheck) { - if (index > ChildrenTokens.Count) + IList children = ChildrenTokens; + + if (index > children.Count) throw new ArgumentOutOfRangeException("index", "Index must be within the bounds of the List."); CheckReentrancy(); item = EnsureParentToken(item, skipParentCheck); - JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; + JToken previous = (index == 0) ? null : children[index - 1]; // haven't inserted new token yet so next token is still at the inserting index - JToken next = (index == ChildrenTokens.Count) ? null : ChildrenTokens[index]; + JToken next = (index == children.Count) ? null : children[index]; ValidateToken(item, null); @@ -372,7 +383,7 @@ namespace Newtonsoft.Json.Linq if (next != null) next.Previous = item; - ChildrenTokens.Insert(index, item); + children.Insert(index, item); #if !(DOTNET || PORTABLE40 || PORTABLE) if (_listChanged != null) @@ -386,16 +397,18 @@ namespace Newtonsoft.Json.Linq internal virtual void RemoveItemAt(int index) { + IList children = ChildrenTokens; + if (index < 0) throw new ArgumentOutOfRangeException("index", "Index is less than 0."); - if (index >= ChildrenTokens.Count) + if (index >= children.Count) throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count."); CheckReentrancy(); - JToken item = ChildrenTokens[index]; - JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; - JToken next = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1]; + JToken item = children[index]; + JToken previous = (index == 0) ? null : children[index - 1]; + JToken next = (index == children.Count - 1) ? null : children[index + 1]; if (previous != null) previous.Next = next; @@ -406,7 +419,7 @@ namespace Newtonsoft.Json.Linq item.Previous = null; item.Next = null; - ChildrenTokens.RemoveAt(index); + children.RemoveAt(index); #if !(DOTNET || PORTABLE40 || PORTABLE) if (_listChanged != null) @@ -437,12 +450,14 @@ namespace Newtonsoft.Json.Linq internal virtual void SetItem(int index, JToken item) { + IList children = ChildrenTokens; + if (index < 0) throw new ArgumentOutOfRangeException("index", "Index is less than 0."); - if (index >= ChildrenTokens.Count) + if (index >= children.Count) throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count."); - JToken existing = ChildrenTokens[index]; + JToken existing = children[index]; if (IsTokenUnchanged(existing, item)) return; @@ -453,8 +468,8 @@ namespace Newtonsoft.Json.Linq ValidateToken(item, existing); - JToken previous = (index == 0) ? null : ChildrenTokens[index - 1]; - JToken next = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1]; + JToken previous = (index == 0) ? null : children[index - 1]; + JToken next = (index == children.Count - 1) ? null : children[index + 1]; item.Parent = this; @@ -466,7 +481,7 @@ namespace Newtonsoft.Json.Linq if (next != null) next.Previous = item; - ChildrenTokens[index] = item; + children[index] = item; existing.Parent = null; existing.Previous = null; @@ -486,14 +501,16 @@ namespace Newtonsoft.Json.Linq { CheckReentrancy(); - foreach (JToken item in ChildrenTokens) + IList children = ChildrenTokens; + + foreach (JToken item in children) { item.Parent = null; item.Previous = null; item.Next = null; } - ChildrenTokens.Clear(); + children.Clear(); #if !(DOTNET || PORTABLE40 || PORTABLE) if (_listChanged != null) diff --git a/Src/NuGet.Config b/Src/NuGet.Config index 83b1a4ed..3da0c229 100644 --- a/Src/NuGet.Config +++ b/Src/NuGet.Config @@ -3,9 +3,9 @@ - - - - + + + + \ No newline at end of file