Extensions
Contains extension methods that do not require a special using directive.
using System;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace NUnit.Framework
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal static class Extensions
{
public static bool IsStatic(this Type type)
{
if (type.IsAbstract)
return type.IsSealed;
return false;
}
public static bool HasAttribute<[System.Runtime.CompilerServices.Nullable(2)] T>(this ICustomAttributeProvider attributeProvider, bool inherit)
{
return attributeProvider.IsDefined(typeof(T), inherit);
}
public static bool HasAttribute<[System.Runtime.CompilerServices.Nullable(2)] T>(this Type type, bool inherit)
{
return ((ICustomAttributeProvider)type).HasAttribute<T>(inherit);
}
public static T[] GetAttributes<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
{
return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit);
}
public static T[] GetAttributes<T>(this Assembly assembly) where T : class
{
return assembly.GetAttributes<T>(false);
}
public static T[] GetAttributes<T>(this Type type, bool inherit) where T : class
{
return ((ICustomAttributeProvider)type).GetAttributes<T>(inherit);
}
[IteratorStateMachine(typeof(<Skip>d__6))]
public static IEnumerable Skip(this IEnumerable enumerable, long skip)
{
<Skip>d__6 <Skip>d__ = new <Skip>d__6(-2);
<Skip>d__.<>3__enumerable = enumerable;
<Skip>d__.<>3__skip = skip;
return <Skip>d__;
}
}
}