Harness proD API Help
EPLAN.Harness.API.ApiProperties.UnitProperties Namespace / UnitClassProperty Class / Equals Method
Object to compare.
Example
In This Topic
    Equals Method (UnitClassProperty)
    In This Topic
    Is this unit class property equal to the following object?
    Syntax
    public override bool Equals( 
       object obj
    )

    Parameters

    obj
    Object to compare.

    Return Value

    True if the object is equal to this property, otherwise False.
    Remarks
    Be careful when comparing unit class properties. The comparison depends on the number of significant digits in project settings. See the code example.
    Example
    This example shows how the result of comparing unit class properties can be different with different settings.
    HpdApi api = HpdApi.GetInstance();
    					
    // Prepare almost the same values.
    LengthProperty length1 = new LengthProperty(1.000000001, Unit.Millimeter);
    LengthProperty length2 = new LengthProperty(1, Unit.Millimeter);
    					
    // Set significant figures for all units to 3.
    api.CurrentProject.Settings.Units.SignificantFigures = 3;
    
    Console.WriteLine($"Is '{length1}' equal to '{length2}'? {length1 == length2}.");
    					
    // Extend the significant figures for all units to 10.
    api.CurrentProject.Settings.Units.SignificantFigures = 10;
    
    Console.WriteLine($"Is '{length1}' equal to '{length2}'? {length1 == length2}.");
    					
    // RESULTS:
    // Is '1 mm' equal to '1 mm'? True.
    // Is '1,000000001 mm' equal to '1 mm'? False.
    See Also