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