CSMSL.Tolerance.Tolerance C# (CSharp) Метод

Tolerance() публичный Метод

Calculates a tolerance from the string representation

i.e., "10 PPM", "-+10 PPM", "5 DA", "±10 MMU", etc...

public Tolerance ( string s ) : System
s string
Результат System
        public Tolerance(string s)
        {
            Match m = StringRegex.Match(s);
            if (!m.Success)
                throw new ArgumentException("Input string is not in the correct format: " + s);
            Type = m.Groups[1].Success ? ToleranceType.PlusAndMinus : ToleranceType.FullWidth;
            Value = double.Parse(m.Groups[2].Value, CultureInfo.CurrentCulture);
            ToleranceUnit type;
            Enum.TryParse(m.Groups[3].Value, true, out type);
            Unit = type;
        }

Same methods

Tolerance::Tolerance ( ToleranceUnit unit, double value, ToleranceType type = ToleranceType.PlusAndMinus ) : System
Tolerance::Tolerance ( ToleranceUnit unit, double experimental, double theoretical, ToleranceType type = ToleranceType.PlusAndMinus ) : System