Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Oystein Bjorke
    @objorke
    (don't know if I can answer...)
    jth41
    @jth41
    Hey thanks! I
    I saw here: https://github.com/objorke/QuantityTypes#examples that you have some really cool functionality
    where you make a length and time object and when they are divided you get back a Velocity! that is super cool, how do you do that without hardcoding that operator into every type? @objorke
    Oystein Bjorke
    @objorke
    those operators are coded manually!
    and the quantity types are generated by T4 templates
    jth41
    @jth41
    So every new class has to have every operator relationship built onto it?
    for example if I added a new random unit lets say VolumeVelocity (how quickly a volume is filled) I would need to add to Volume and Speed the operators returning that new type?
    Oystein Bjorke
    @objorke
    yes
    jth41
    @jth41
    VolumeVelocity v = new Volume()/ new Time()
    Oystein Bjorke
    @objorke
    I think the custom operators are defined in partial classes to allow the standard operators to be auto-generated.
    is it "volumetric flow rate"? I have tried to use the same names as wikipedia http://en.wikipedia.org/wiki/Volumetric_flow_rate
    jth41
    @jth41
    gotcha, ok thx for your help. I run this project: https://bitbucket.org/Clearspan/unit-class-library/wiki/Home and was looking for a less tedious way to keep that kind of functionality up to date
    That was just an example I tht of off my head but yes thats what I meant
    Oystein Bjorke
    @objorke
    cool, I will have a look at your project
    jth41
    @jth41
    Would love to compare notes on our libraries, if thats ok
    Oystein Bjorke
    @objorke
    no problem! It's interesting to learn if there are better ways to do this!
    I have added a link to your project on the readme page!
    jth41
    @jth41
    Hey thanks!
    You might also be interested in our other library built on top: https://bitbucket.org/Clearspan/geometry-class-library
    I'm now getting self conscious finding broken links in our readme lol. Yours all seem to work!
    Oystein Bjorke
    @objorke
    thanks for testing :-) please post links if you find more libraries like this
    jth41
    @jth41
    Sure thing. Are you doing anything special for equality?
    Oystein Bjorke
    @objorke
    no, in this library the quantities are value types, and it is similar to comparing a double
    jth41
    @jth41
    Gotcha, That is the only reason we didn't go with value types, It was a super tough problem to solve and I'm not super happy with the solution. But in our library the types can be dynamically changed to consider equality differently for each object
    Anders Gustafsson
    @anders9ustafsson
    @objorke Great work with this library! I noticed above you were asking for links to alternative libraries, so I am going to be bold enough to mention my own project, CSUnits. I originally started developing it in 2011 as I was not really pleased with the way other C# libraries worked at the time. The project has been on hold for a few years, but a few weeks back I resumed development, partially inspired by your work, in particular the extensive use of T4 templates.
    I checked performance using your tests, and computation times seem to be on par with QuantityTypes (with a big exception for unit multiplication initialization, where the unit representation in CSUnits prevents it from being as a fast as QuantityTypes in that particular area.)
    Please go ahead and take a look at CSUnits if you like.
    Best regards, Anders @ Cureos
    Oystein Bjorke
    @objorke
    @anders9ustafsson Thanks for the link! I have added your project to https://github.com/objorke/QuantityTypes/wiki ! I will have a closer look at your solution later :-)
    Ryan Elian
    @ryanelian

    Hi! I would like to know how to set the default units for parsing. (README said it's possible "Configurable (set default units for parsing and formatting)", but I can't seem to find the way to do it.

    For example, I would like to have the value of QuantityTypes.Length.Parse("123") to be 123mm instead of meters. Is that possible?

    Thank you in advance!

    Oystein Bjorke
    @objorke
    @ryanelian It should be possible to do this with the default "unit provider", try setting default "display unit" of type Length (I am not looking at the code right now, so this is a guess and I may be wrong...)
    Oystein Bjorke
    @objorke
    changed target to netstandard1.0!
    Oystein Bjorke
    @objorke
    changed target to netstandard1.3
    and multi-target to net45
    released v4.0.0
    known issues: 0 :-)