コード例 #1
0
 private void Validate(IHasConstructors holder, IList <IConstructor> constrs)
 {
     foreach (var constr in constrs)
     {
         Validate(constr, constr.Parameters);
     }
 }
コード例 #2
0
 public static bool TryGetConstructor(this IHasConstructors hasConstructors, out ICommonConstructor foundCommonConstructor)
 {
     return((foundCommonConstructor = hasConstructors.GetConstructor()) != null);
 }
コード例 #3
0
 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"));
 }
コード例 #4
0
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, IHasType[] constructorParameterHasTypes, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.GetConstructor(constructorParameterHasTypes.Select(type => type.Type).ToArray(), throwExceptionIfNotFound));
 }
コード例 #5
0
 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"));
 }
コード例 #6
0
 public static ICommonConstructor GetConstructor(this IHasConstructors hasConstructors, bool throwExceptionIfNotFound = false)
 {
     return(hasConstructors.GetConstructor(Type.EmptyTypes, throwExceptionIfNotFound));
 }
コード例 #7
0
 public static bool TryGetConstructor(this IHasConstructors hasConstructors, string[] constructorParameterTypeFullNames, out ICommonConstructor foundCommonConstructor)
 {
     return((foundCommonConstructor = hasConstructors.GetConstructor(constructorParameterTypeFullNames)) != null);
 }
コード例 #8
0
 public static IEnumerable <SyntaxNode> GetCstrNodes(this SyntaxGenerator gen, IHasConstructors holder)
 => holder.Constructors.OfType <IHasSyntaxNodes>().SelectMany(n => n.GetNodes(gen));