-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XamlParserTests crashes with dotnet test exception for net47 #34
Comments
Since collection is guaranteed to be append-only, we should probably use a specialized enumerator there, e. g. struct AppendOnlyListEnumerator<T> : IEnumerator<T>
{
private readonly IReadOnlyList<T> _list;
private int _index;
public AppendOnlyListEnumerator(IReadOnlyList<T> list)
{
_list = list;
_index = -1;
}
public bool MoveNext()
{
if (_list.Count > _index + 1)
{
_index++;
return true;
}
return false;
}
public void Reset() => _index = -1;
public T Current => _list[_index];
object IEnumerator.Current => Current;
public void Dispose()
{
}
}
struct AppendOnlyEnumerable<T> : IEnumerable<T>
{
private readonly IReadOnlyList<T> _list;
public AppendOnlyEnumerable(IReadOnlyList<T> list)
{
_list = list;
}
public IEnumerator<T> GetEnumerator()
{
return new AppendOnlyListEnumerator<T>(_list);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
static class ListExtensions
{
public static AppendOnlyEnumerable<T> EnumerateAsAppendOnly<T>(this List<T> list) =>
new AppendOnlyEnumerable<T>(list);
} |
Can we replace IReadOnlyList with IEnumerable in a similar way? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
XamlParserTests crashes with dotnet test exception for net47
If you write
ToList()
here, then everything will be fineXamlX/src/XamlX/IL/SreTypeSystem.cs
Line 18 in 697a419
Unlike #33, here it seems to me that the problem of the main library
The text was updated successfully, but these errors were encountered: