private bool ConstructorParametersMatchProperties(ConstructorDefinition constructor)
 {
     return constructor.Parameters
         .All(CanBeAssignedFromProperty);
 }
        private object TryGetTypedValue()
        {
            if (typedValue != null)
                return typedValue;

            if (chosenConstructor == null)
            {
                IEnumerable<ConstructorDefinition> constructors = TypeDef.Constructors;
                chosenConstructor = constructors.FirstOrDefault(ConstructorParametersMatchProperties);

                if (chosenConstructor == null)
                    throw new NoMatchingConstructor(TypeDef.Type, Properties);
            }

            PopulateConstructorParameters();

            if (typedValue != null) // If any constructor arguments have references back to this structure, it will already have been constructed while populating their properties
                return typedValue;

            typedValue = chosenConstructor.Construct(constructorArguments.ToArray());

            foreach (KeyValuePair<string, ObjectOutput> property in Properties)
            {
                CurrentProperty = property.Key;
                StructureDef.AssignValueToProperty(typedValue, property.Key, property.Value);
            }

            return typedValue;
        }