The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

Getting Started

  • 2 min to read
Important

You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.

Perform the following steps to get started with the Unit Conversion API.

  1. Start Microsoft Visual Studio and create a new Windows Forms Application project.

  2. On the Project menu, choose Add Reference. Alternatively, you can right-click your project in Solution Explorer and then click Add Reference. The Reference Manager dialog window is displayed. Select the DevExpress.Docs.v19.1.dll assembly and then click OK.

  3. Drag a Button control from the Toolbox and drop it on the form.
  4. Double click the button. Paste the code below in the ButtonClick event handler.

    using DevExpress.UnitConversion;
    //...
    // The height is 5'4".
    QuantityValue<Distance> height = (5.0).Feet() + (4.0).Inches();
    string s = String.Format("The height is {0} ells or {1} meters.",
        height.ToElls().Value.ToString("g3"), height.ToMeters().Value.ToString("g3"));
    MessageBox.Show(s);
    
  5. Run the project and click the button.

    units_getstarted

  1. Start Microsoft Visual Studio and create a new Console Application (NET Core) project.

  2. Install the DevExpress.Document.Processor NuGet package.

  3. Paste the code below in the Main method of the Program.cs file (Main procedure of the Module1.vb file for Visual Basic).

    using DevExpress.UnitConversion;
    
    QuantityValue<Distance> height = (5.0).Feet() + (4.0).Inches();
    string s = String.Format("The height is {0} ells or {1} meters.",
    height.ToElls().Value.ToString("g3"), height.ToMeters().Value.ToString("g3"));
    Console.WriteLine(s);
    
  4. Run the project.

    result