private object GetConstructorParameterPropertyValue(ParameterDefinition parameter)
        {
            string propertyName = AvailablePropertyName(parameter.Name);

            if (propertyName == null)
                return null;

            ObjectOutput property = Properties[propertyName];

            TypeDefinition typeDef = TypeCache.GetTypeDefinition(parameter.Type);
            object propertyValue = typeDef.ConvertToCorrectType(property.GetTypedValue());

            Properties.Remove(propertyName);    // Don't want to re-populate property that's being passed into the constructor

            return propertyValue;
        }
 private bool HasPropertyValue(ParameterDefinition parameter)
 {
     ObjectOutput value = GetProperty(parameter.Name);
     return value != null
         && value.TypeDef != NullTypeDefinition.Instance;
 }
 private static bool ParameterCanBeNull(ParameterDefinition parameter)
 {
     return !parameter.Type.IsValueType;
 }
 private bool CanBeAssignedFromProperty(ParameterDefinition parameter)
 {
     return HasPropertyValue(parameter)
         ? ParameterTypeMatchesPropertyValue(parameter)
         : ParameterCanBeNull(parameter);
 }
        private bool ParameterTypeMatchesPropertyValue(ParameterDefinition parameter)
        {
            ObjectOutput property = GetProperty(parameter.Name);
            Type propertyValueType = property.TypeDef.Type;
            TypeCodeType propertyValueTypeCodeType = propertyValueType.GetTypeCodeType();

            return propertyValueTypeCodeType == TypeCodeType.Object
                ? propertyValueType.CanBeCastTo(parameter.Type)
                : (propertyValueTypeCodeType == parameter.Type.GetTypeCodeType() ||
                   parameter.Type == typeof(object));
        }