Skip to content

Commit 6502d75

Browse files
committed
address issue
1 parent 212151f commit 6502d75

File tree

1 file changed

+12
-15
lines changed
  • articles/applied-ai-services/form-recognizer/includes/get-started

1 file changed

+12
-15
lines changed

articles/applied-ai-services/form-recognizer/includes/get-started/csharp.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,18 @@ In this quickstart, you'll use the following APIs to extract structured data fro
8080

8181
To interact with the Form Recognizer service, you'll need to create an instance of the `FormRecognizerClient` class. To do so, you'll create an `AzureKeyCredential` with your key and a `FormRecognizerClient` instance with the `AzureKeyCredential` and your Form Recognizer `endpoint`.
8282

83+
> [!NOTE]
84+
>
85+
> * Starting with .NET 6, new projects using the `console` template generate a new program style that differs from previous versions.
86+
> * The new output uses recent C# features that simplify the code you need to write.
87+
> * When you use the newer version, you only need to write the body of the `Main` method. You don't need to include top-level statements, global using directives, or implicit using directives.
88+
> * For more information, *see* [**New C# templates generate top-level statements**](/dotnet/core/tutorials/top-level-templates).
89+
8390
1. Open the **Program.cs** file.
8491

8592
1. Include the following using directives:
8693

8794
```csharp
88-
using System;
8995
using Azure;
9096
using Azure.AI.FormRecognizer;
9197
using Azure.AI.FormRecognizer.Models;
@@ -100,7 +106,7 @@ private static readonly string key = "your-api-key";
100106
private static readonly AzureKeyCredential credential = new AzureKeyCredential(key);
101107
```
102108

103-
1. Delete the line, `Console.Writeline("Hello World!");` , and add one of the **Try It** code samples to the **Main** method in the **Program.cs** file:
109+
1. Delete the line, `Console.Writeline("Hello World!");` , and add one of the **Try It** code samples to **Program.cs** file:
104110

105111
:::image type="content" source="../../media/quickstarts/add-code-here.png" alt-text="Screenshot: add the sample code to the Main method.":::
106112

@@ -124,19 +130,14 @@ Extract text, selection marks, text styles, and table structures, along with the
124130
> * We've added the file URI value to the `formUri` variable.
125131
> * To extract the layout from a given file at a URI, use the `StartRecognizeContentFromUriAsync` method.
126132
127-
### Add the following code to your layout application **Main** method:
133+
### Add the following code to your layout application Program.cs file:
128134

129135
```csharp
130136

131137
FormRecognizerClient recognizerClient = AuthenticateClient();
132138

133139
Task recognizeContent = RecognizeContent(recognizerClient);
134140
Task.WaitAll(recognizeContent);
135-
```
136-
137-
### Add the following code below the **Main** method:
138-
139-
```csharp
140141

141142
private static FormRecognizerClient AuthenticateClient()
142143
{
@@ -198,18 +199,14 @@ You are not limited to invoices—there are several prebuilt models to choose fr
198199
* [**ID document**](../../concept-id-document.md): extracts text and key information from driver licenses and international passports.
199200
* [**Business-card**](../../concept-business-card.md): extracts text and key information from business cards.
200201

201-
### Add the following code to your prebuilt invoice application **Main** method
202+
### Add the following code to your prebuilt invoice application Program.cs file method
202203

203204
```csharp
204205
FormRecognizerClient recognizerClient = AuthenticateClient();
205206

206-
Task analyzeinvoice = AnalyzeInvoice(recognizerClient, invoiceUrl);
207-
Task.WaitAll(analyzeinvoice);
208-
```
209-
210-
### Add the following code below the **Main** method:
207+
Task analyzeinvoice = AnalyzeInvoice(recognizerClient, invoiceUrl);
208+
Task.WaitAll(analyzeinvoice);
211209

212-
```csharp
213210
private static FormRecognizerClient AuthenticateClient() {
214211
var credential = new AzureKeyCredential(key);
215212
var client = new FormRecognizerClient(new Uri(endpoint), credential);

0 commit comments

Comments
 (0)