MimeKit.ParserOptions.GetConstructor C# (CSharp) Method

GetConstructor() static private method

static private GetConstructor ( TypeInfo type, Type argTypes ) : ConstructorInfo
type System.Reflection.TypeInfo
argTypes System.Type
return System.Reflection.ConstructorInfo
		static ConstructorInfo GetConstructor (TypeInfo type, Type[] argTypes)
		{
			foreach (var ctor in type.DeclaredConstructors) {
				var args = ctor.GetParameters ();

				if (args.Length != ConstructorArgTypes.Length)
					continue;

				bool matched = true;
				for (int i = 0; i < argTypes.Length && matched; i++)
					matched = matched && args[i].ParameterType == argTypes[i];

				if (matched)
					return ctor;
			}

			return null;
		}
#endif