committed by
James Newton-King
parent
f663060005
commit
0b187df8cb
@@ -67,12 +67,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public IEnumerator<T> GetEnumerator()
|
public IEnumerator<T> GetEnumerator()
|
||||||
{
|
{
|
||||||
if (_enumerable == null)
|
return (_enumerable ?? Empty).GetEnumerator();
|
||||||
{
|
|
||||||
return Empty.GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _enumerable.GetEnumerator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
|
|||||||
@@ -169,24 +169,12 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public virtual IEnumerator<T> GetEnumerator()
|
public virtual IEnumerator<T> GetEnumerator()
|
||||||
{
|
{
|
||||||
if (_genericCollection != null)
|
return (_genericCollection ?? _list.Cast<T>()).GetEnumerator();
|
||||||
{
|
|
||||||
return _genericCollection.GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _list.Cast<T>().GetEnumerator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
if (_genericCollection != null)
|
return ((IEnumerable)_genericCollection ?? _list).GetEnumerator();
|
||||||
{
|
|
||||||
return _genericCollection.GetEnumerator();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _list.GetEnumerator();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int IList.Add(object value)
|
int IList.Add(object value)
|
||||||
@@ -333,17 +321,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
|
|
||||||
public object UnderlyingCollection
|
public object UnderlyingCollection
|
||||||
{
|
{
|
||||||
get
|
get { return (object)_genericCollection ?? _list; }
|
||||||
{
|
|
||||||
if (_genericCollection != null)
|
|
||||||
{
|
|
||||||
return _genericCollection;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user