devexpress/agent-skills/devexpress-office-file-api-unit-conversion
Claude Code and agent skill by devexpress/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Build .NET applications with the DevExpress Unit Conversion API for converting between metric and US units of measurement with type-safe fluent syntax. Use when converting distances, lengths, weights, temperatures, areas, volumes, speeds, or metric prefixes in .NET applications. Also use when someone mentions "DevExpress Unit Conversion", "UnitConversion", "DevExpress.UnitConversion", "convert units C#", "metric to imperial", "length conversion .NET", or asks about any unit conversion with DevE…
Install
npx vskill@latest install devexpress/agent-skills/devexpress-office-file-api-unit-conversionSKILL.md
DevExpress Unit Conversion API
A lightweight .NET library for converting between metric and US customary units of measurement using a type-safe fluent API. Supports distance, mass, temperature, area, volume, speed, and metric prefix conversions. The API requires no external dependencies beyond the DevExpress.Document.Processor NuGet package and works identically on .NET 8+ and .NET Framework 4.6.2+.
When to Use This Skill
Use this skill when you need to:
- Convert distances or lengths (meters, feet, miles, kilometers, inches, yards, nautical miles)
- Convert mass/weight values (grams, kilograms, pounds, ounces, metric tons)
- Convert temperatures (Celsius, Fahrenheit, Kelvin)
- Convert area measurements (square meters, square feet, acres, hectares, square miles)
- Convert volumes (liters, gallons, cubic meters, cubic feet, fluid ounces, pints, quarts)
- Convert speeds (km/h, m/s, mph, knots, feet per second)
- Convert between metric prefixes (kilo, mega, milli, micro, etc.)
- Combine unit values with arithmetic (e.g., 5 feet + 4 inches, then convert to meters)
- Build type-safe unit-aware calculations without manual conversion factors
Prerequisites & Installation
NuGet Packages
| Package | Purpose | |
|---|---|---|
DevExpress.Document.Processor | Unit Conversion API (included in the package) |
.NET (8/9/10+)
.NET Framework (4.6.2+)
Or add a direct reference to DevExpress.Docs.v26.1.dll.
Important: All DevExpress packages in a project must share the same version number. A valid DevExpress license is required.
Package Versions
Unless the user explicitly requests a specific version, always target the latest DevExpress release (v26.1 at the time of writing). dotnet add package <PackageName> without --version installs the latest stable version — prefer this form. Never pin an older version in project files, Dockerfiles, or CI/CD pipelines unless the user asks for it. This is especially important in integration scenarios (Docker, cloud deployments). All DevExpress.* packages in a project must share the same version.
Before You Start — Ask the Developer
If the host agent has a structured question-asking tool available, use it to ask these questions one at a time with clear options — for example, Claude Code's AskUserQuestion tool or GitHub Copilot's askQuestions tool. If no such tool is available, ask the questions directly in the chat response before generating code.
Before generating code, ask these questions to avoid rework:
General Questions
- Target framework: Are you using .NET 8+ or .NET Framework 4.x?
- New or existing project?: Creating new or adding to existing?
- Hosting model: Console app, ASP.NET Core, Blazor, MAUI, WinForms, or something else?
Unit Conversion-Specific Questions
- Measurement category: Which category? (length / weight / temperature / area / volume / speed / metric prefix)
- Conversion direction: Metric to US, US to metric, between metric prefixes, or both directions?
Rule: If the developer's answer is ambiguous or missing, ask before generating code. Do not guess.
Component Overview
The Unit Conversion API provides two usage patterns:
- Fluent extension methods on numeric types (
double,int,float) — create aQuantityValue<T>, then callTo{Unit}()to convert.QuantityValue<T>implicitly converts todouble, so you can use it directly in arithmetic or string formatting. - Static converter classes accessed via
Units.*— call.Convert(value, fromUnit, toUnit)for direct scalar conversion without creatingQuantityValue<T>objects.
Key classes:
- `QuantityValue<T>` (
struct) — holds a value in a specific unit. Supports+,-,*,/operators. Implicitly converts todouble. - `Units` (
static class) — entry point for converter instances:Units.Distance,Units.Mass,Units.Temperature,Units.Area,Units.Volume,Units.Speed,Units.Metric. - `Distance`, `Mass`, `Temperature`, `Area`, `Volume`, `Speed`, `MetricPrefix` — enums listing available unit values for each category.
- `DistanceUnitsConverter`, `MassUnitsConverter`, etc. — converter classes returned by
Units.*properties.
Core Entry Point — Fluent API
Core Entry Point — Units.Convert() API
Documentation & Navigation Guide
Getting Started
Refer to references/getting-started.md
When you need to:
- Install the NuGet package and set up the namespace
- Perform your first conversion (distance, weight, temperature)
- Understand both fluent and
Units.Convert()patterns - See all measurement categories with one example each
- Combine values with arithmetic operators
Quick Start Example
What This Does
Demonstrates the two API patterns: fluent extension methods returning QuantityValue<T> (distance, mass, temperature) and direct scalar conversion via Units.*.Convert() (speed, metric prefix). Both patterns work identically on .NET and .NET Framework.
Key Properties & API Surface
QuantityValue\<T\>
| Property/Operator | Type | Description | |
|---|---|---|---|
Value | double | Numeric value in the current unit | |
implicit double | double | Implicit conversion — use directly in math/strings | |
+ / - | QuantityValue<T> | Add or subtract same-category quantities | |
* / / | QuantityValue<T> | Multiply or divide by a scalar |
Units (static class)
| Property | Type | Description | |
|---|---|---|---|
Units.Distance | DistanceUnitsConverter | Distance/length conversions | |
Units.Mass | MassUnitsConverter | Mass/weight conversions | |
Units.Temperature | TemperatureUnitsConverter | Temperature conversions | |
Units.Area | AreaUnitsConverter | Area conversions | |
Units.Volume | VolumeUnitsConverter | Volume conversions | |
Units.Speed | SpeedUnitsConverter | Speed conversions | |
Units.Metric | MetricUnitsConverter | Metric prefix conversions |
BaseUnitsConverter\<T\>.Convert()
Distance Enum Values (most common)
Distance.Meter, Distance.Foot, Distance.Inch, Distance.Yard, Distance.MileStatute, Distance.MileNautical, Distance.Kilometer (via MetricPrefix), Distance.Angstrom
Note: Kilometer is not a directDistanceenum value. Use theMetricPrefixconverter or the.Kilometers()extension method which internally handles the prefix.
Area Enum Values
Area.SquareMeter, Area.SquareMile, Area.SquareMileNautical, Area.Hectare, Area.SquareFoot, Area.SquareInch, Area.SquareYard, Area.AcreInternational, Area.AcreStatute, Area.Are, Area.Morgen
IMPORTANT — `Area.SquareKilometer` does not exist in this enum.To convert to or from square kilometers, convert viaArea.SquareMeterfirst, then divide or multiply by 1,000,000:```csharp// 2.5 square miles → square kilometersdouble squareMeters = Units.Area.Convert(2.5, Area.SquareMile, Area.SquareMeter);double squareKm = squareMeters / 1_000_000.0;Console.WriteLine($"2.5 sq mi = {squareKm:F4} km²");// 10 km² → square milesdouble sqMiles = Units.Area.Convert(10.0 * 1_000_000.0, Area.SquareMeter, Area.SquareMile);Console.WriteLine($"10 km² = {sqMiles:F4} sq mi");```
Mass Enum Values
Mass.Gram, Mass.Pound, Mass.Ounce, Mass.Ton, Mass.TonImperial, Mass.Stone, Mass.Slug
Note: Kilogram is not a directMassenum value inUnits.Mass.Convert(). Use the fluent.Kilograms()extension method, orUnits.Metric.Convert(value, MetricPrefix.None, MetricPrefix.Kilo)after getting grams.
Temperature Enum Values
Temperature.Celsius, Temperature.Fahrenheit, Temperature.Kelvin, Temperature.Rankine, Temperature.Reaumur
Speed Enum Values
Speed.MetersPerHour, Speed.MetersPerSecond, Speed.MilesPerHour, Speed.Knot, Speed.KnotAdmiralty
MetricPrefix Enum Values
MetricPrefix.Tera, MetricPrefix.Giga, MetricPrefix.Mega, MetricPrefix.Kilo, MetricPrefix.Hecto, MetricPrefix.Deca, MetricPrefix.None, MetricPrefix.Deci, MetricPrefix.Centi, MetricPrefix.Milli, MetricPrefix.Micro, MetricPrefix.Nano, MetricPrefix.Pico, MetricPrefix.Femto, MetricPrefix.Atto
Common Patterns
Fluent Conversion (simple)
Fluent Conversion (compound)
Direct Scalar Conversion
Batch Array Conversion
Metric Prefix Conversion
Volume Conversion
Troubleshooting
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/dx-office-file-api/skills/devexpress-office-file-api-unit-conversion/SKILL.md
Popularity
- Repository stars
- 52
- Repository forks
- 8
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/devexpress/agent-skills/devexpress-office-file-api-unit-conversion)