-
Notifications
You must be signed in to change notification settings - Fork 393
Unit: Piece or Amount missing #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, there is no unit that work with the concept of "piece" or "amount", because I think fundamentally these are not units - you don't convert between them. They are simply amounts, or numeric. If you could post some code that would provide some context, that may be helpful to understand why we possibly want to add a piece unit. |
The closest unit is https://github.com/anjdreas/UnitsNet/blob/master/UnitsNet/GeneratedCode/UnitClasses/Ratio.g.cs |
Hi, I want to realize something like a shopping cart functionality. Imagine I can buy flour and glasses. Both have articlenumbers, I want to offer flour based on weight, and glasses per piece. I plan to add generic articles in the Shopping cart. pseudo-code I hope this shows the problem. Is this doable with UnitNet? |
Hi, to be more precise, I need something like this: UoM quantity1 = Amount.Value(5); // assumption unit is pieces - the unit must not have a name UoM should then contain:
No special calculations for Amount (+ - * /) |
I really think this is best solved outside Units.NET on a per-application basis with a wrapper type to store the meta-information.
So for a shopping list, I would create a list of If I needed to get the sum of liters of milk and there were two items of 0.5L and 1L each, I would probably do something like Another option is to let |
Do you have any further comments here? |
No, fine for me thanks. I will find another way then. |
Ok, closing this until there is a more clear usecase for bringing this into the lib. |
Hello,
How can I use UnitsNet lib for a concrete amount of things.
UseCase: Shopping Cart
Is there a way to do this?
The text was updated successfully, but these errors were encountered: