GeometryGym.Ifc.ParserIfc.extractDerivedMeasureValue C# (CSharp) Méthode

extractDerivedMeasureValue() static private méthode

static private extractDerivedMeasureValue ( Type type, string value ) : IfcDerivedMeasureValue
type System.Type
value string
Résultat IfcDerivedMeasureValue
        internal static IfcDerivedMeasureValue extractDerivedMeasureValue(Type type, string value)
        {
            if (type.GetInterfaces().Contains(typeof(IfcDerivedMeasureValue)))
            {
                double val = 0;
                if (double.TryParse(value, out val))
                {
                    Type[] types = new Type[] { typeof(double) };
                    ConstructorInfo constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
            null, types, null);
                    if (constructor != null)
                        return constructor.Invoke(new object[] { val }) as IfcDerivedMeasureValue;
                }
            }
            return null;
        }