The Inner Drive Extensible Architecture™—the Idea™

Demonstration: Measurements

The Idea™ has a full library of measurement conversions that you can use with no additional setup. This demo shows how it works:

Demo

How this works

We're pleased to announce that we've put a full SDK up on the site, so you can see what we've been up to. (Important note: This is living product documentation, subject to change at any point.)

Each of the principal types of measurement—area, length, speed, etc.—is a distinct .NET structure. This means that the compiler, not the developer, controls what kind of measurements are possible for a particular phenomenon.

However, all of the built-in measurement structures implement IMeasurable, which defines a number of properties and methods useful for a generic converter like this one.

The framework also defines an abstract Unit class, and a collection of concrete measurement units that derive from it. Each contains its own list of conversion factors, meaning that measurements can convert directly to other measurements without going through an intermediary; and the conversion framework is completely extensible, since new Unit classes can simply define their own conversion list.

Converting measurements becomes trivial in most cases:

Length meters = new Length(3000d); // defaults to meters
Length feet = meters.ConvertTo(typeof(Foot));

// feet.ToString("0.0000") yields "9842.5197 ft."

In version 4.1, we added fluent instantiation to make your code even clearer:

var km = 3000d.Kilometers();

// km.ToString("0.0000") yields "3000.0000 km"

Even compound units, such as those used for Speed and Pressure, are easy to handle:

var psi = new ForceOverArea(new Pound(), new InchSquare());
var atmospheres = pressure.ConvertTo(typeof(Atmosphere));

(Of course, fluent is easier:)

var pressure = (29.92d).PSI();
Inner Drive Extensible Architecture - Quantitative
Bases and classes to support quantity, measurement, and unit conversion

Version 5.0.8597.0 Release CLR 7.0.15 7/15/2023 3:37 PM
Copyright ©2023 Inner Drive Technology. All rights reserved. Portions Copyright ©1986-2023 David Braverman.


inner-drive.com
The public-facing website for Inner Drive Technology

Version 2.1.8767.0 Release CLR 7.0.15 1/1/2024 5:25 PM
Copyright ©2024 Inner Drive Technology. All rights reserved. Portions Copyright ©1986-2024 David Braverman.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙