Skip to content

Fix some occurrences of using statement #18419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Most files in Blazor projects are *.razor* files. Razor is a templating language

Each Razor component file is compiled into a .NET class when the project is built. The generated class captures the component's state, rendering logic, lifecycle methods, event handlers, and other logic. We'll look at authoring components in the [Building reusable UI components with Blazor](./components.md) section.

The *_Imports.razor* files aren't Razor component files. Instead, they define a set of Razor directives to import into other *.razor* files within the same folder and in its subfolders. For example, a *_Imports.razor* file is a conventional way to add `using` statements for commonly used namespaces:
The *_Imports.razor* files aren't Razor component files. Instead, they define a set of Razor directives to import into other *.razor* files within the same folder and in its subfolders. For example, a *_Imports.razor* file is a conventional way to add `using` directives for commonly used namespaces:

```razor
@using System.Net.Http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Dapper is an open-source project (original created by Sam Saffron), and is part

![Screenshot of the Dapper package in the NuGet packages view.](./media/cqrs-microservice-reads/drapper-package-nuget.png)

You also need to add a using statement so your code has access to the Dapper extension methods.
You also need to add a `using` directive so your code has access to the Dapper extension methods.

When you use Dapper in your code, you directly use the <xref:System.Data.SqlClient.SqlConnection> class available in the <xref:System.Data.SqlClient> namespace. Through the QueryAsync method and other extension methods that extend the <xref:System.Data.SqlClient.SqlConnection> class, you can simply run queries in a straightforward and performant way.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ When you use fields instead of properties, the `OrderItem` entity is persisted a
At the implementation level, a repository is simply a class with data persistence code coordinated by a unit of work (DBContext in EF Core) when performing updates, as shown in the following class:

```csharp
// using statements...
// using directives...
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
{
public class BuyerRepository : IBuyerRepository
Expand Down
2 changes: 1 addition & 1 deletion docs/core/additional-tools/dotnet-svcutil-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The generated file is saved as _HelloSvcutil/ServiceReference/Reference.cs_. The

2. Find the name of the client class and operation you want to use. `Reference.cs` will contain a class that inherits from `System.ServiceModel.ClientBase`, with methods that can be used to call operations on the service. In this example, you want to call the _SayHello_ service's _Hello_ operation. `ServiceReference.SayHelloClient` is the name of the client class, and has a method called `HelloAsync` that can be used to call the operation.

3. Open the `Startup.cs` file in your editor, and add a using statement for the service reference namespace at the top:
3. Open the `Startup.cs` file in your editor, and add a `using` directive for the service reference namespace at the top:

```csharp
using ServiceReference;
Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/indexers.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ to create a public interface that represents your abstraction, even though
the underlying storage must use different core collection types.

There are two parts of this code that may be unfamiliar
to some developers. These two `using` statements:
to some developers. These two `using` directives:

```csharp
using DateMeasurements = System.Collections.Generic.Dictionary<System.DateTime, IndexersSamples.Common.Measurements>;
Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/keywords/using-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The following example uses the `using static` directive to make the static membe

[!code-csharp[using-static#3](~/samples/snippets/csharp/language-reference/keywords/using/using-static3.cs)]

In the example, the `using static` directive could also have been applied to the <xref:System.Double> type. This would have made it possible to call the <xref:System.Double.TryParse(System.String,System.Double@)> method without specifying a type name. However, this creates less readable code, since it becomes necessary to check the `using static` statements to determine which numeric type's `TryParse` method is called.
In the example, the `using static` directive could also have been applied to the <xref:System.Double> type. This would have made it possible to call the <xref:System.Double.TryParse(System.String,System.Double@)> method without specifying a type name. However, this creates less readable code, since it becomes necessary to check the `using static` directives to determine which numeric type's `TryParse` method is called.

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can use the async feature to access files. By using the async feature, you c
## Running the Examples
To run the examples in this topic, you can create a **WPF Application** or a **Windows Forms Application** and then add a **Button**. In the button's `Click` event, add a call to the first method in each example.

In the following examples, include the following `using` statements.
In the following examples, include the following `using` directives.

```csharp
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Next, format the new declaration to match C# formatting rules. Formatting your c

[!code-csharp[Format the new declaration](~/samples/snippets/csharp/roslyn-sdk/Tutorials/MakeConst/MakeConst/MakeConstCodeFixProvider.cs#FormatLocal "Format the new declaration")]

A new namespace is required for this code. Add the following `using` statement to the top of the file:
A new namespace is required for this code. Add the following `using` directive to the top of the file:

```csharp
using Microsoft.CodeAnalysis.Formatting;
Expand Down Expand Up @@ -492,7 +492,7 @@ That sounds like a lot of code. It's not. Replace the line that declares and ini

[!code-csharp[Replace Var designations](~/samples/snippets/csharp/roslyn-sdk/Tutorials/MakeConst/MakeConst/MakeConstCodeFixProvider.cs#ReplaceVar "Replace a var designation with the explicit type")]

You'll need to add one `using` statement to use the <xref:Microsoft.CodeAnalysis.Simplification.Simplifier> type:
You'll need to add one `using` directive to use the <xref:Microsoft.CodeAnalysis.Simplification.Simplifier> type:

```csharp
using Microsoft.CodeAnalysis.Simplification;
Expand Down