Ejemplo n.º 1
0
 private void Validate(IHasConstructors holder, IList <IConstructor> constrs)
 {
     foreach (var constr in constrs)
     {
         Validate(constr, constr.Parameters);
     }
 }
 public static bool TryGetConstructor(this IHasConstructors hasConstructors, out ICommonConstructor foundCommonConstructor)
 {
     return((foundCommonConstructor = hasConstructors.GetConstructor()) != null);
 }
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, string[] constructorParameterTypeFullNames, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.Constructors.SingleOrDefault(constructor => constructor.ParameterTypes.Select(type => type.FullName.NullIfEmpty() ?? type.Name).SequenceEqual(constructorParameterTypeFullNames ?? new string[0]), throwExceptionIfNotFound, ".ctor"));
 }
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, IHasType[] constructorParameterHasTypes, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.GetConstructor(constructorParameterHasTypes.Select(type => type.Type).ToArray(), throwExceptionIfNotFound));
 }
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, Type[] constructorParameterTypes, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.Constructors.SingleOrDefault(constructor => constructor.ParameterTypes.SequenceEqual(constructorParameterTypes ?? Type.EmptyTypes), throwExceptionIfNotFound, ".ctor"));
 }
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.GetConstructor(Type.EmptyTypes, throwExceptionIfNotFound));
 }
 public static bool TryGetConstructor(this IHasConstructors hasConstructors, string[] constructorParameterTypeFullNames, out ICommonConstructor foundCommonConstructor)
 {
     return((foundCommonConstructor = hasConstructors.GetConstructor(constructorParameterTypeFullNames)) != null);
 }
Ejemplo n.º 8
0
 public static IEnumerable <SyntaxNode> GetCstrNodes(this SyntaxGenerator gen, IHasConstructors holder)
 => holder.Constructors.OfType <IHasSyntaxNodes>().SelectMany(n => n.GetNodes(gen));