Skip to content

Commit 6fcc698

Browse files
authored
Merge pull request #539 from FreeBono/add-document-csharp
Add instructions for API Dash-generated code in csharp(HttpClient)
2 parents 8664a8f + 37b6c02 commit 6fcc698

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,75 @@ TODO
4343

4444
## C# (HttpClient)
4545

46-
TODO
46+
Here are the detailed instructions for running the generated API Dash code in C# (using `HttpClient`) for macOS, Windows, and Linux:
47+
48+
### 1. Setting Up the C# Development Environment
49+
#### macOS and Windows:
50+
1. **Install .NET SDK:**
51+
- Visit the [official .NET download page](https://dotnet.microsoft.com/download).
52+
- Download and install the latest .NET SDK for macOS.
53+
2. **Verify Installation:**
54+
- Open the terminal and run the following command to verify the installation:
55+
```bash
56+
dotnet --version
57+
```
58+
59+
#### Linux:
60+
1. **Install .NET SDK:**
61+
- Run the following commands based on your distribution:
62+
- For Ubuntu/Debian-based systems:
63+
```bash
64+
sudo apt update
65+
sudo apt install dotnet-sdk-7.0
66+
```
67+
- For Fedora/CentOS-based systems:
68+
```bash
69+
sudo dnf install dotnet-sdk-7.0
70+
```
71+
2. **Verify Installation:**
72+
- Open the terminal and run the following command to verify the installation:
73+
```bash
74+
dotnet --version
75+
```
76+
77+
### 2. Preparing a Project
78+
79+
#### In Visual Studio:
80+
1. **Create a New Project:**
81+
- Open Visual Studio and select **Create a new project**.
82+
- Choose the **Console Application (.NET Core)** template and create the project.
83+
84+
2. **Check `System.Net.Http` Namespace:**
85+
- `HttpClient` is included by default. No additional installation is required.
86+
87+
#### Using the CLI:
88+
1. **Create a Project:**
89+
```bash
90+
dotnet new console -n HttpClientExample
91+
cd HttpClientExample
92+
```
93+
94+
2. **Install the Package (if necessary):**
95+
```bash
96+
dotnet add package System.Net.Http
97+
```
98+
99+
### 3. Execute the generated code:
100+
Once you have .NET(C#) and `HttpClient` installed, follow these steps to execute the generated code:
101+
102+
1. **Open a IDE/text editor** ✍️ (Visual Studio, VS Code or any other text editor).
103+
2. **Copy the generated code** 📋 from API Dash.
104+
3. **Paste the code** into your project. ex) prgoram.cs
105+
106+
#### In Visual Studio:
107+
1. Click the **Start Debugging (F5)** button from the top menu to run the project.
108+
2. The output window will display the API response.
109+
110+
#### Using the CLI:
111+
1. Open the terminal at the project root directory and run the following command:
112+
```bash
113+
dotnet run
114+
```
47115

48116
## C# (RestSharp)
49117

0 commit comments

Comments
 (0)