Skip to content

Can not set QuantityName for Custom Units #1418

@Chef904

Description

@Chef904

I cannot set the QuantiyName for a custom Unit because the constructor is internal.

This is the code exampe in this repo:

public QuantityInfo QuantityInfo => new(
            nameof(HowMuch),
            typeof(HowMuchUnit),
            new UnitInfo[]
            {
                new UnitInfo<HowMuchUnit>(HowMuchUnit.Some, "Some", BaseUnits.Undefined, nameof(HowMuch)),
                new UnitInfo<HowMuchUnit>(HowMuchUnit.ATon, "Tons", BaseUnits.Undefined, nameof(HowMuch)),
                new UnitInfo<HowMuchUnit>(HowMuchUnit.AShitTon, "ShitTons", BaseUnits.Undefined, nameof(HowMuch)),
            },
            HowMuchUnit.Some,
            Zero,
            BaseDimensions.Dimensionless);

But in an other Assembly where i have my custom units, i cannot add the quantity Name to my UnitInfo:

grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions