2019-09-24 08:53:40 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
|
2017-08-21 15:34:15 +00:00
|
|
|
namespace Mono.Cecil
|
|
|
|
{
|
|
|
|
static partial class Mixin {
|
|
|
|
|
|
|
|
public static bool IsTypeSpecification (this TypeReference type)
|
|
|
|
{
|
|
|
|
return type is GenericParameter || type is TypeSpecification;
|
|
|
|
}
|
2019-09-24 08:53:40 +00:00
|
|
|
|
|
|
|
public static IEnumerable<MethodDefinition> GetConstructors (this TypeDefinition type)
|
|
|
|
{
|
|
|
|
if (type == null)
|
|
|
|
throw new ArgumentNullException (nameof (type));
|
|
|
|
|
|
|
|
if (!type.HasMethods)
|
|
|
|
return Array.Empty<MethodDefinition> ();
|
|
|
|
|
|
|
|
return type.Methods.Where (method => method.IsConstructor);
|
|
|
|
}
|
2017-08-21 15:34:15 +00:00
|
|
|
}
|
|
|
|
}
|