Skip to content

How to add a unit to an existing quantity? #1246

Closed

Description

@jasekiw

I am trying to add a custom unit for our project that should go under ElectricResistivity. It is MeterPerSiemens (m/S) and is a 1 to 1 conversion to OhmMeter.

I tried following the documentation below however it only gives examples on how to add a custom quantity with units. I want to add a unit to an existing quantity (ElectricResistivity), not a new one.
https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units

How would I go about adding a unit to an existing quantity? Once that is determined, I think the documentation should be updated to include the instructions.

Activity

  1. angularsen commented on May 7, 2023

    @angularsen
    Owner

    Hi, I've added some more info to the top of the wiki page. In particular, why adding units to existing quantities is currently not feasible.

    Please take a look and let me know if it helps or how it could improve further:
    https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units

  2. jasekiw commented on May 8, 2023

    @jasekiw
    ContributorAuthor

    @angularsen Thank you for the section in the documentation. It makes it much more clear. Seeing as it's not possible to add a unit, would this unit be a candidate to officially add it to the library? I don't want to go through the effort of creating a PR if it is going to get denied. Thanks!

  3. angularsen commented on May 8, 2023

    @angularsen
    Owner

    Yes, that sounds reasonable to add.
    Please go ahead with the pull request, just follow the instructions in the wiki and ping me if you have any questions. 👍

  4. github-actions commented on Jul 8, 2024

    @github-actions
    Contributor

    This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions