/// <summary> /// Gets the predefined construction from a <see cref="PredefinedConstructionType"/>. /// </summary> /// <param name="type">The type</param> /// <returns>The construction</returns> public static PredefinedConstruction GetPredefinedconstruction(PredefinedConstructionType type) { // Find the property info for the property handling our predefined type var propertyInfo = typeof(PredefinedConstructions).GetProperty(type.ToString()); // Check if it's not null if (propertyInfo == null) { throw new GeoGenException($"The type {type} of a construction doesn't have the implementation in the {nameof(PredefinedConstructions)} class."); } // Otherwise we invoke it and return the casted result return((PredefinedConstruction)propertyInfo.GetMethod.Invoke(obj: null, parameters: null)); }
/// <summary> /// Initializes a new instance of the <see cref="PredefinedConstruction"/> class. /// </summary> /// <param name="type">The type of the predefined construction.</param> /// <param name="parameters">The parameters representing the signature of the construction.</param> /// <param name="outputType">The output type of the construction.</param> public PredefinedConstruction(PredefinedConstructionType type, IReadOnlyList <ConstructionParameter> parameters, ConfigurationObjectType outputType) : base(type.ToString(), parameters, outputType) { Type = type; }