A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
539 B

using System;
using System.Collections;
namespace Avalonia.Markup.UnitTests
{
internal static class IEnumerableExtensions
{
public static object ElementAt(this IEnumerable source, int index)
{
var i = -1;
var enumerator = source.GetEnumerator();
while (enumerator.MoveNext() && ++i < index);
if (i == index)
{
return enumerator.Current;
}
throw new ArgumentOutOfRangeException(nameof(index));
}
}
}