C# Client#

This guide provides step-by-step instructions for developing and running a Dlubal API client.

Prerequisites#

Before you begin, ensure your system meets the following requirements:

  1. Install the .NET Core SDK (version .NET 8.0 or higher).

    • You’ll need the .NET SDK to install and use NuGet packages in a .NET-based project.

    • Verify the installation by running:

      dotnet --version
      
  2. Install Visual Studio Code as your code editor (for free).

    • Verify the installation by running:

      code --version
      
  3. Install C# Dev Kit extension in VS Code:

    • Open the Extensions view by pressing Ctrl+Shift+X.

    • Search for C# Dev Kit and click Install.

Create a New Project#

  1. Open Visual Studio Code.

  2. Create a New Project with the C# Dev Kit installed:

    • Open the Command Palette by pressing Ctrl+Shift+P

    • Type .NET: New Project... and select it from the list.

    • Choose Console App or another project type from the options.

    • Follow the prompts to select a project template, the target framework, and the location to create the project.

  1. Openining the Project

    • Once the project is created, VS Code will automatically open the folder containing your project, so you can start working directly on it.

Install the Dlubal API Package#

  1. Installing NuGet package from the Terminal (CLI)

    • Open the Terminal in your project directory (press Ctrl+`)

    • Run the following command to install the Dlubal API package into your project.

      dotnet add package Dlubal.Api
      
    • If you need to install a specific version of the package (for example, version 2.10.8), you can do so by appending the --version flag followed by the desired version number:

      dotnet add package Dlubal.Api --version 2.10.8
      

    Important

    The API client version must match the version of your Dlubal application to ensure full compatibility. For example, API client version 2.10.8 corresponds to RFEM 6.10.0008 / RSTAB 9.10.0008.

  2. Verify the Installation

    • Run the following command

      dotnet list package
      
    • Ensure Dlubal.Api appears in the list of installed packages.

Using the Package#

using Dlubal.Api.Rfem;

ApplicationRfem rfemApp = new ApplicationRfem(
    apiKeyValue: "your_api_key_value"
);

var applicationInfo = rfemApp.get_application_info();
Console.WriteLine($"Application Info:\n{applicationInfo}");

rfemApp.close_connection();