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

extractMeasureValue() static private méthode

static private extractMeasureValue ( Type type, string value ) : IfcMeasureValue
type System.Type
value string
Résultat IfcMeasureValue
        internal static IfcMeasureValue extractMeasureValue(Type type, string value)
        {
            if (type.GetInterfaces().Contains(typeof(IfcMeasureValue)))
            {
                if (string.Compare(type.Name,"IfcDescriptiveMeasure",true) == 0)
                    return new IfcDescriptiveMeasure(value);
                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 IfcMeasureValue;
                }
            }
            return null;
        }