diff --git a/docs/csharp/programming-guide/concepts/async/task-asynchronous-programming-model.md b/docs/csharp/programming-guide/concepts/async/task-asynchronous-programming-model.md
index f692b6d242ad6..3fceca27135e4 100644
--- a/docs/csharp/programming-guide/concepts/async/task-asynchronous-programming-model.md
+++ b/docs/csharp/programming-guide/concepts/async/task-asynchronous-programming-model.md
@@ -4,326 +4,336 @@ ms.date: 05/22/2017
ms.assetid: 9bcf896a-5826-4189-8c1a-3e35fa08243a
---
# Task asynchronous programming model
-You can avoid performance bottlenecks and enhance the overall responsiveness of your application by using asynchronous programming. However, traditional techniques for writing asynchronous applications can be complicated, making them difficult to write, debug, and maintain.
-
-[C# 5](../../../whats-new/csharp-version-history.md#c-version-50) introduced a simplified approach, async programming, that leverages asynchronous support in the .NET Framework 4.5 and higher, .NET Core, and the Windows Runtime. The compiler does the difficult work that the developer used to do, and your application retains a logical structure that resembles synchronous code. As a result, you get all the advantages of asynchronous programming with a fraction of the effort.
-
-This topic provides an overview of when and how to use async programming and includes links to support topics that contain details and examples.
-
-## Async improves responsiveness
- Asynchrony is essential for activities that are potentially blocking, such as web access. Access to a web resource sometimes is slow or delayed. If such an activity is blocked in a synchronous process, the entire application must wait. In an asynchronous process, the application can continue with other work that doesn't depend on the web resource until the potentially blocking task finishes.
-
- The following table shows typical areas where asynchronous programming improves responsiveness. The listed APIs from .NET and the Windows Runtime contain methods that support async programming.
-
+
+You can avoid performance bottlenecks and enhance the overall responsiveness of your application by using asynchronous programming. However, traditional techniques for writing asynchronous applications can be complicated, making them difficult to write, debug, and maintain.
+
+[C# 5](../../../whats-new/csharp-version-history.md#c-version-50) introduced a simplified approach, async programming, that leverages asynchronous support in the .NET Framework 4.5 and higher, .NET Core, and the Windows Runtime. The compiler does the difficult work that the developer used to do, and your application retains a logical structure that resembles synchronous code. As a result, you get all the advantages of asynchronous programming with a fraction of the effort.
+
+This topic provides an overview of when and how to use async programming and includes links to support topics that contain details and examples.
+
+## Async improves responsiveness
+
+Asynchrony is essential for activities that are potentially blocking, such as web access. Access to a web resource sometimes is slow or delayed. If such an activity is blocked in a synchronous process, the entire application must wait. In an asynchronous process, the application can continue with other work that doesn't depend on the web resource until the potentially blocking task finishes.
+
+The following table shows typical areas where asynchronous programming improves responsiveness. The listed APIs from .NET and the Windows Runtime contain methods that support async programming.
+
| Application area | .NET types with async methods | Windows Runtime types with async methods |
|---------------------|-----------------------------------|-------------------------------------------|
|Web access|||
-|Working with files|, , ||
-|Working with images||, , |
-|WCF programming|[Synchronous and Asynchronous Operations](../../../../framework/wcf/synchronous-and-asynchronous-operations.md)||
-
-Asynchrony proves especially valuable for applications that access the UI thread because all UI-related activity usually shares one thread. If any process is blocked in a synchronous application, all are blocked. Your application stops responding, and you might conclude that it has failed when instead it's just waiting.
-
- When you use asynchronous methods, the application continues to respond to the UI. You can resize or minimize a window, for example, or you can close the application if you don't want to wait for it to finish.
-
- The async-based approach adds the equivalent of an automatic transmission to the list of options that you can choose from when designing asynchronous operations. That is, you get all the benefits of traditional asynchronous programming but with much less effort from the developer.
-
-## Async methods are easier to write
- The [async](../../../../csharp/language-reference/keywords/async.md) and [await](../../../../csharp/language-reference/keywords/await.md) keywords in C# are the heart of async programming. By using those two keywords, you can use resources in the .NET Framework, .NET Core, or the Windows Runtime to create an asynchronous method almost as easily as you create a synchronous method. Asynchronous methods that you define by using the `async` keyword are referred to as *async methods*.
-
- The following example shows an async method. Almost everything in the code should look completely familiar to you.
-
- You can find a complete Windows Presentation Foundation (WPF) example file at the end of this topic, and you can download the sample from [Async Sample: Example from "Asynchronous Programming with Async and Await"](https://code.msdn.microsoft.com/Async-Sample-Example-from-9b9f505c).
-
-```csharp
-async Task AccessTheWebAsync()
-{
- // You need to add a reference to System.Net.Http to declare client.
- using (HttpClient client = new HttpClient())
- {
- Task getStringTask = client.GetStringAsync("https://docs.microsoft.com");
-
- DoIndependentWork();
-
- string urlContents = await getStringTask;
-
- return urlContents.Length;
- }
-}
-```
-
- You can learn several practices from the preceding sample. start with the method signature. It includes the `async` modifier. The return type is `Task` (See "Return Types" section for more options). The method name ends in `Async`. In the body of the method, `GetStringAsync` returns a `Task`. That means that when you `await` the task you'll get a `string` (`urlContents`). Before awaiting the task, you can do work that doesn't rely on the `string` from `GetStringAsync`.
-
- Pay close attention to the `await` operator. It suspends `AccessTheWebAsync`;
-
-- `AccessTheWebAsync` can't continue until `getStringTask` is complete.
-- Meanwhile, control returns to the caller of `AccessTheWebAsync`.
-- Control resumes here when `getStringTask` is complete.
-- The `await` operator then retrieves the `string` result from `getStringTask`.
-
- The return statement specifies an integer result. Any methods that are awaiting `AccessTheWebAsync` retrieve the length value.
-
- If `AccessTheWebAsync` doesn't have any work that it can do between calling `GetStringAsync` and awaiting its completion, you can simplify your code by calling and awaiting in the following single statement.
-
-```csharp
-string urlContents = await client.GetStringAsync("https://docs.microsoft.com");
-```
-
-The following characteristics summarize what makes the previous example an async method.
-
-- The method signature includes an `async` modifier.
-
-- The name of an async method, by convention, ends with an "Async" suffix.
-
-- The return type is one of the following types:
-
- - if your method has a return statement in which the operand has type `TResult`.
-
- - if your method has no return statement or has a return statement with no operand.
-
- - `void` if you're writing an async event handler.
-
- - Any other type that has a `GetAwaiter` method (starting with C# 7.0).
-
- For more information, see the [Return Types and Parameters](#BKMK_ReturnTypesandParameters) section.
-
-- The method usually includes at least one `await` expression, which marks a point where the method can't continue until the awaited asynchronous operation is complete. In the meantime, the method is suspended, and control returns to the method's caller. The next section of this topic illustrates what happens at the suspension point.
-
- In async methods, you use the provided keywords and types to indicate what you want to do, and the compiler does the rest, including keeping track of what must happen when control returns to an await point in a suspended method. Some routine processes, such as loops and exception handling, can be difficult to handle in traditional asynchronous code. In an async method, you write these elements much as you would in a synchronous solution, and the problem is solved.
-
- For more information about asynchrony in previous versions of the .NET Framework, see [TPL and Traditional .NET Framework Asynchronous Programming](../../../../standard/parallel-programming/tpl-and-traditional-async-programming.md).
-
-## What happens in an async method
- The most important thing to understand in asynchronous programming is how the control flow moves from method to method. The following diagram leads you through the process.
-
- 
-
- The numbers in the diagram correspond to the following steps, initiated when the user clicks the "start" button.
-
-1. An event handler calls and awaits the `AccessTheWebAsync` async method.
-
-2. `AccessTheWebAsync` creates an instance and calls the asynchronous method to download the contents of a website as a string.
-
-3. Something happens in `GetStringAsync` that suspends its progress. Perhaps it must wait for a website to download or some other blocking activity. To avoid blocking resources, `GetStringAsync` yields control to its caller, `AccessTheWebAsync`.
-
- `GetStringAsync` returns a , where `TResult` is a string, and `AccessTheWebAsync` assigns the task to the `getStringTask` variable. The task represents the ongoing process for the call to `GetStringAsync`, with a commitment to produce an actual string value when the work is complete.
-
-4. Because `getStringTask` hasn't been awaited yet, `AccessTheWebAsync` can continue with other work that doesn't depend on the final result from `GetStringAsync`. That work is represented by a call to the synchronous method `DoIndependentWork`.
-
-5. `DoIndependentWork` is a synchronous method that does its work and returns to its caller.
-
-6. `AccessTheWebAsync` has run out of work that it can do without a result from `getStringTask`. `AccessTheWebAsync` next wants to calculate and return the length of the downloaded string, but the method can't calculate that value until the method has the string.
-
- Therefore, `AccessTheWebAsync` uses an await operator to suspend its progress and to yield control to the method that called `AccessTheWebAsync`. `AccessTheWebAsync` returns a `Task` to the caller. The task represents a promise to produce an integer result that's the length of the downloaded string.
-
+|Working with files|, , ||
+|Working with images||, , |
+|WCF programming|[Synchronous and Asynchronous Operations](../../../../framework/wcf/synchronous-and-asynchronous-operations.md)||
+
+Asynchrony proves especially valuable for applications that access the UI thread because all UI-related activity usually shares one thread. If any process is blocked in a synchronous application, all are blocked. Your application stops responding, and you might conclude that it has failed when instead it's just waiting.
+
+When you use asynchronous methods, the application continues to respond to the UI. You can resize or minimize a window, for example, or you can close the application if you don't want to wait for it to finish.
+
+The async-based approach adds the equivalent of an automatic transmission to the list of options that you can choose from when designing asynchronous operations. That is, you get all the benefits of traditional asynchronous programming but with much less effort from the developer.
+
+## Async methods are easier to write
+
+The [async](../../../../csharp/language-reference/keywords/async.md) and [await](../../../../csharp/language-reference/keywords/await.md) keywords in C# are the heart of async programming. By using those two keywords, you can use resources in the .NET Framework, .NET Core, or the Windows Runtime to create an asynchronous method almost as easily as you create a synchronous method. Asynchronous methods that you define by using the `async` keyword are referred to as *async methods*.
+
+The following example shows an async method. Almost everything in the code should look completely familiar to you.
+
+You can find a complete Windows Presentation Foundation (WPF) example file at the end of this topic, and you can download the sample from [Async Sample: Example from "Asynchronous Programming with Async and Await"](https://code.msdn.microsoft.com/Async-Sample-Example-from-9b9f505c).
+
+```csharp
+async Task AccessTheWebAsync()
+{
+ // You need to add a reference to System.Net.Http to declare client.
+ using (HttpClient client = new HttpClient())
+ {
+ Task getStringTask = client.GetStringAsync("https://docs.microsoft.com");
+
+ DoIndependentWork();
+
+ string urlContents = await getStringTask;
+
+ return urlContents.Length;
+ }
+}
+```
+
+You can learn several practices from the preceding sample. start with the method signature. It includes the `async` modifier. The return type is `Task` (See "Return Types" section for more options). The method name ends in `Async`. In the body of the method, `GetStringAsync` returns a `Task`. That means that when you `await` the task you'll get a `string` (`urlContents`). Before awaiting the task, you can do work that doesn't rely on the `string` from `GetStringAsync`.
+
+Pay close attention to the `await` operator. It suspends `AccessTheWebAsync`;
+
+- `AccessTheWebAsync` can't continue until `getStringTask` is complete.
+- Meanwhile, control returns to the caller of `AccessTheWebAsync`.
+- Control resumes here when `getStringTask` is complete.
+- The `await` operator then retrieves the `string` result from `getStringTask`.
+
+The return statement specifies an integer result. Any methods that are awaiting `AccessTheWebAsync` retrieve the length value.
+
+If `AccessTheWebAsync` doesn't have any work that it can do between calling `GetStringAsync` and awaiting its completion, you can simplify your code by calling and awaiting in the following single statement.
+
+```csharp
+string urlContents = await client.GetStringAsync("https://docs.microsoft.com");
+```
+
+The following characteristics summarize what makes the previous example an async method.
+
+- The method signature includes an `async` modifier.
+
+- The name of an async method, by convention, ends with an "Async" suffix.
+
+- The return type is one of the following types:
+
+ - if your method has a return statement in which the operand has type `TResult`.
+
+ - if your method has no return statement or has a return statement with no operand.
+
+ - `void` if you're writing an async event handler.
+
+ - Any other type that has a `GetAwaiter` method (starting with C# 7.0).
+
+ For more information, see the [Return Types and Parameters](#BKMK_ReturnTypesandParameters) section.
+
+- The method usually includes at least one `await` expression, which marks a point where the method can't continue until the awaited asynchronous operation is complete. In the meantime, the method is suspended, and control returns to the method's caller. The next section of this topic illustrates what happens at the suspension point.
+
+In async methods, you use the provided keywords and types to indicate what you want to do, and the compiler does the rest, including keeping track of what must happen when control returns to an await point in a suspended method. Some routine processes, such as loops and exception handling, can be difficult to handle in traditional asynchronous code. In an async method, you write these elements much as you would in a synchronous solution, and the problem is solved.
+
+For more information about asynchrony in previous versions of the .NET Framework, see [TPL and Traditional .NET Framework Asynchronous Programming](../../../../standard/parallel-programming/tpl-and-traditional-async-programming.md).
+
+## What happens in an async method
+
+The most important thing to understand in asynchronous programming is how the control flow moves from method to method. The following diagram leads you through the process.
+
+
+
+The numbers in the diagram correspond to the following steps, initiated when the user clicks the "start" button.
+
+1. An event handler calls and awaits the `AccessTheWebAsync` async method.
+
+2. `AccessTheWebAsync` creates an instance and calls the asynchronous method to download the contents of a website as a string.
+
+3. Something happens in `GetStringAsync` that suspends its progress. Perhaps it must wait for a website to download or some other blocking activity. To avoid blocking resources, `GetStringAsync` yields control to its caller, `AccessTheWebAsync`.
+
+ `GetStringAsync` returns a , where `TResult` is a string, and `AccessTheWebAsync` assigns the task to the `getStringTask` variable. The task represents the ongoing process for the call to `GetStringAsync`, with a commitment to produce an actual string value when the work is complete.
+
+4. Because `getStringTask` hasn't been awaited yet, `AccessTheWebAsync` can continue with other work that doesn't depend on the final result from `GetStringAsync`. That work is represented by a call to the synchronous method `DoIndependentWork`.
+
+5. `DoIndependentWork` is a synchronous method that does its work and returns to its caller.
+
+6. `AccessTheWebAsync` has run out of work that it can do without a result from `getStringTask`. `AccessTheWebAsync` next wants to calculate and return the length of the downloaded string, but the method can't calculate that value until the method has the string.
+
+ Therefore, `AccessTheWebAsync` uses an await operator to suspend its progress and to yield control to the method that called `AccessTheWebAsync`. `AccessTheWebAsync` returns a `Task` to the caller. The task represents a promise to produce an integer result that's the length of the downloaded string.
+
> [!NOTE]
- > If `GetStringAsync` (and therefore `getStringTask`) completes before `AccessTheWebAsync` awaits it, control remains in `AccessTheWebAsync`. The expense of suspending and then returning to `AccessTheWebAsync` would be wasted if the called asynchronous process (`getStringTask`) has already completed and `AccessTheWebSync` doesn't have to wait for the final result.
-
- Inside the caller (the event handler in this example), the processing pattern continues. The caller might do other work that doesn't depend on the result from `AccessTheWebAsync` before awaiting that result, or the caller might await immediately. The event handler is waiting for `AccessTheWebAsync`, and `AccessTheWebAsync` is waiting for `GetStringAsync`.
-
-7. `GetStringAsync` completes and produces a string result. The string result isn't returned by the call to `GetStringAsync` in the way that you might expect. (Remember that the method already returned a task in step 3.) Instead, the string result is stored in the task that represents the completion of the method, `getStringTask`. The await operator retrieves the result from `getStringTask`. The assignment statement assigns the retrieved result to `urlContents`.
-
-8. When `AccessTheWebAsync` has the string result, the method can calculate the length of the string. Then the work of `AccessTheWebAsync` is also complete, and the waiting event handler can resume. In the full example at the end of the topic, you can confirm that the event handler retrieves and prints the value of the length result.
-If you are new to asynchronous programming, take a minute to consider the difference between synchronous and asynchronous behavior. A synchronous method returns when its work is complete (step 5), but an async method returns a task value when its work is suspended (steps 3 and 6). When the async method eventually completes its work, the task is marked as completed and the result, if any, is stored in the task.
-
-For more information about control flow, see [Control Flow in Async Programs (C#)](../../../../csharp/programming-guide/concepts/async/control-flow-in-async-programs.md).
-
-## API async methods
- You might be wondering where to find methods such as `GetStringAsync` that support async programming. The .NET Framework 4.5 or higher and .NET Core contain many members that work with `async` and `await`. You can recognize them by the "Async" suffix that’s appended to the member name, and by their return type of or . For example, the `System.IO.Stream` class contains methods such as , , and alongside the synchronous methods , , and .
-
- The Windows Runtime also contains many methods that you can use with `async` and `await` in Windows apps. For more information, see [Threading and async programming](/windows/uwp/threading-async/) for UWP development, and [Asynchronous programming (Windows Store apps)](https://docs.microsoft.com/previous-versions/windows/apps/hh464924(v=win.10)) and [Quickstart: Calling asynchronous APIs in C# or Visual Basic](https://docs.microsoft.com/previous-versions/windows/apps/hh452713(v=win.10)) if you use earlier versions of the Windows Runtime.
-
-## Threads
-Async methods are intended to be non-blocking operations. An `await` expression in an async method doesn’t block the current thread while the awaited task is running. Instead, the expression signs up the rest of the method as a continuation and returns control to the caller of the async method.
-
-The `async` and `await` keywords don't cause additional threads to be created. Async methods don't require multithreading because an async method doesn't run on its own thread. The method runs on the current synchronization context and uses time on the thread only when the method is active. You can use to move CPU-bound work to a background thread, but a background thread doesn't help with a process that's just waiting for results to become available.
-
-The async-based approach to asynchronous programming is preferable to existing approaches in almost every case. In particular, this approach is better than the class for I/O-bound operations because the code is simpler and you don't have to guard against race conditions. In combination with the method, async programming is better than for CPU-bound operations because async programming separates the coordination details of running your code from the work that `Task.Run` transfers to the threadpool.
-
-## async and await
- If you specify that a method is an async method by using the [async](../../../../csharp/language-reference/keywords/async.md) modifier, you enable the following two capabilities.
-
-- The marked async method can use [await](../../../../csharp/language-reference/keywords/await.md) to designate suspension points. The `await` operator tells the compiler that the async method can't continue past that point until the awaited asynchronous process is complete. In the meantime, control returns to the caller of the async method.
-
- The suspension of an async method at an `await` expression doesn't constitute an exit from the method, and `finally` blocks don’t run.
-
-- The marked async method can itself be awaited by methods that call it.
-
-An async method typically contains one or more occurrences of an `await` operator, but the absence of `await` expressions doesn’t cause a compiler error. If an async method doesn’t use an `await` operator to mark a suspension point, the method executes as a synchronous method does, despite the `async` modifier. The compiler issues a warning for such methods.
-
- `async` and `await` are contextual keywords. For more information and examples, see the following topics:
-
-- [async](../../../../csharp/language-reference/keywords/async.md)
-
-- [await](../../../../csharp/language-reference/keywords/await.md)
-
-## Return types and parameters
-An async method typically returns a or a . Inside an async method, an `await` operator is applied to a task that's returned from a call to another async method.
-
-You specify as the return type if the method contains a [`return`](../../../../csharp/language-reference/keywords/return.md) statement that specifies an operand of type `TResult`.
-
-You use as the return type if the method has no return statement or has a return statement that doesn't return an operand.
+ > If `GetStringAsync` (and therefore `getStringTask`) completes before `AccessTheWebAsync` awaits it, control remains in `AccessTheWebAsync`. The expense of suspending and then returning to `AccessTheWebAsync` would be wasted if the called asynchronous process (`getStringTask`) has already completed and `AccessTheWebSync` doesn't have to wait for the final result.
+
+ Inside the caller (the event handler in this example), the processing pattern continues. The caller might do other work that doesn't depend on the result from `AccessTheWebAsync` before awaiting that result, or the caller might await immediately. The event handler is waiting for `AccessTheWebAsync`, and `AccessTheWebAsync` is waiting for `GetStringAsync`.
+
+7. `GetStringAsync` completes and produces a string result. The string result isn't returned by the call to `GetStringAsync` in the way that you might expect. (Remember that the method already returned a task in step 3.) Instead, the string result is stored in the task that represents the completion of the method, `getStringTask`. The await operator retrieves the result from `getStringTask`. The assignment statement assigns the retrieved result to `urlContents`.
+
+8. When `AccessTheWebAsync` has the string result, the method can calculate the length of the string. Then the work of `AccessTheWebAsync` is also complete, and the waiting event handler can resume. In the full example at the end of the topic, you can confirm that the event handler retrieves and prints the value of the length result.
+If you are new to asynchronous programming, take a minute to consider the difference between synchronous and asynchronous behavior. A synchronous method returns when its work is complete (step 5), but an async method returns a task value when its work is suspended (steps 3 and 6). When the async method eventually completes its work, the task is marked as completed and the result, if any, is stored in the task.
+
+For more information about control flow, see [Control Flow in Async Programs (C#)](../../../../csharp/programming-guide/concepts/async/control-flow-in-async-programs.md).
+
+## API async methods
+
+You might be wondering where to find methods such as `GetStringAsync` that support async programming. The .NET Framework 4.5 or higher and .NET Core contain many members that work with `async` and `await`. You can recognize them by the "Async" suffix that’s appended to the member name, and by their return type of or . For example, the `System.IO.Stream` class contains methods such as , , and alongside the synchronous methods , , and .
+
+The Windows Runtime also contains many methods that you can use with `async` and `await` in Windows apps. For more information, see [Threading and async programming](/windows/uwp/threading-async/) for UWP development, and [Asynchronous programming (Windows Store apps)](https://docs.microsoft.com/previous-versions/windows/apps/hh464924(v=win.10)) and [Quickstart: Calling asynchronous APIs in C# or Visual Basic](https://docs.microsoft.com/previous-versions/windows/apps/hh452713(v=win.10)) if you use earlier versions of the Windows Runtime.
+
+## Threads
+
+Async methods are intended to be non-blocking operations. An `await` expression in an async method doesn’t block the current thread while the awaited task is running. Instead, the expression signs up the rest of the method as a continuation and returns control to the caller of the async method.
+
+The `async` and `await` keywords don't cause additional threads to be created. Async methods don't require multithreading because an async method doesn't run on its own thread. The method runs on the current synchronization context and uses time on the thread only when the method is active. You can use to move CPU-bound work to a background thread, but a background thread doesn't help with a process that's just waiting for results to become available.
+
+The async-based approach to asynchronous programming is preferable to existing approaches in almost every case. In particular, this approach is better than the class for I/O-bound operations because the code is simpler and you don't have to guard against race conditions. In combination with the method, async programming is better than for CPU-bound operations because async programming separates the coordination details of running your code from the work that `Task.Run` transfers to the threadpool.
+
+## async and await
+
+If you specify that a method is an async method by using the [async](../../../../csharp/language-reference/keywords/async.md) modifier, you enable the following two capabilities.
+
+- The marked async method can use [await](../../../../csharp/language-reference/keywords/await.md) to designate suspension points. The `await` operator tells the compiler that the async method can't continue past that point until the awaited asynchronous process is complete. In the meantime, control returns to the caller of the async method.
+
+ The suspension of an async method at an `await` expression doesn't constitute an exit from the method, and `finally` blocks don’t run.
+
+- The marked async method can itself be awaited by methods that call it.
+
+An async method typically contains one or more occurrences of an `await` operator, but the absence of `await` expressions doesn’t cause a compiler error. If an async method doesn’t use an `await` operator to mark a suspension point, the method executes as a synchronous method does, despite the `async` modifier. The compiler issues a warning for such methods.
+
+`async` and `await` are contextual keywords. For more information and examples, see the following topics:
+
+- [async](../../../../csharp/language-reference/keywords/async.md)
+
+- [await](../../../../csharp/language-reference/keywords/await.md)
+
+## Return types and parameters
+
+An async method typically returns a or a . Inside an async method, an `await` operator is applied to a task that's returned from a call to another async method.
+
+You specify as the return type if the method contains a [`return`](../../../../csharp/language-reference/keywords/return.md) statement that specifies an operand of type `TResult`.
+
+You use as the return type if the method has no return statement or has a return statement that doesn't return an operand.
Starting with C# 7.0, you can also specify any other return type, provided that the type includes a `GetAwaiter` method. is an example of such a type. It is available in the [System.Threading.Tasks.Extension](https://www.nuget.org/packages/System.Threading.Tasks.Extensions/) NuGet package.
-
- The following example shows how you declare and call a method that returns a or a .
-
-```csharp
-// Signature specifies Task
-async Task GetTaskOfTResultAsync()
-{
- int hours = 0;
- await Task.Delay(0);
- // Return statement specifies an integer result.
- return hours;
-}
-
-// Calls to GetTaskOfTResultAsync
-Task returnedTaskTResult = GetTaskOfTResultAsync();
-int intResult = await returnedTaskTResult;
-// or, in a single statement
-int intResult = await GetTaskOfTResultAsync();
-
-// Signature specifies Task
-async Task GetTaskAsync()
-{
- await Task.Delay(0);
- // The method has no return statement.
-}
-
-// Calls to GetTaskAsync
-Task returnedTask = GetTaskAsync();
-await returnedTask;
-// or, in a single statement
-await GetTaskAsync();
-```
-
-Each returned task represents ongoing work. A task encapsulates information about the state of the asynchronous process and, eventually, either the final result from the process or the exception that the process raises if it doesn't succeed.
-
-An async method can also have a `void` return type. This return type is used primarily to define event handlers, where a `void` return type is required. Async event handlers often serve as the starting point for async programs.
-
-An async method that has a `void` return type can’t be awaited, and the caller of a void-returning method can't catch any exceptions that the method throws.
-
-An async method can't declare [in](../../../../csharp/language-reference/keywords/in-parameter-modifier.md), [ref](../../../../csharp/language-reference/keywords/ref.md) or [out](../../../../csharp/language-reference/keywords/out-parameter-modifier.md) parameters, but the method can call methods that have such parameters. Similarly, an async method can't return a value by reference, although it can call methods with ref return values.
-
-For more information and examples, see [Async Return Types (C#)](../../../../csharp/programming-guide/concepts/async/async-return-types.md). For more information about how to catch exceptions in async methods, see [try-catch](../../../../csharp/language-reference/keywords/try-catch.md).
-
-Asynchronous APIs in Windows Runtime programming have one of the following return types, which are similar to tasks:
-
-- , which corresponds to
-
-- , which corresponds to
-
--
-
--
-
-## Naming convention
+
+The following example shows how you declare and call a method that returns a or a .
+
+```csharp
+// Signature specifies Task
+async Task GetTaskOfTResultAsync()
+{
+ int hours = 0;
+ await Task.Delay(0);
+ // Return statement specifies an integer result.
+ return hours;
+}
+
+// Calls to GetTaskOfTResultAsync
+Task returnedTaskTResult = GetTaskOfTResultAsync();
+int intResult = await returnedTaskTResult;
+// or, in a single statement
+int intResult = await GetTaskOfTResultAsync();
+
+// Signature specifies Task
+async Task GetTaskAsync()
+{
+ await Task.Delay(0);
+ // The method has no return statement.
+}
+
+// Calls to GetTaskAsync
+Task returnedTask = GetTaskAsync();
+await returnedTask;
+// or, in a single statement
+await GetTaskAsync();
+```
+
+Each returned task represents ongoing work. A task encapsulates information about the state of the asynchronous process and, eventually, either the final result from the process or the exception that the process raises if it doesn't succeed.
+
+An async method can also have a `void` return type. This return type is used primarily to define event handlers, where a `void` return type is required. Async event handlers often serve as the starting point for async programs.
+
+An async method that has a `void` return type can’t be awaited, and the caller of a void-returning method can't catch any exceptions that the method throws.
+
+An async method can't declare [in](../../../../csharp/language-reference/keywords/in-parameter-modifier.md), [ref](../../../../csharp/language-reference/keywords/ref.md) or [out](../../../../csharp/language-reference/keywords/out-parameter-modifier.md) parameters, but the method can call methods that have such parameters. Similarly, an async method can't return a value by reference, although it can call methods with ref return values.
+
+For more information and examples, see [Async Return Types (C#)](../../../../csharp/programming-guide/concepts/async/async-return-types.md). For more information about how to catch exceptions in async methods, see [try-catch](../../../../csharp/language-reference/keywords/try-catch.md).
+
+Asynchronous APIs in Windows Runtime programming have one of the following return types, which are similar to tasks:
+
+- , which corresponds to
+
+- , which corresponds to
+
+-
+
+-
+
+## Naming convention
+
By convention, methods that return commonly awaitable types (e.g. `Task`, `Task`, `ValueTask`, `ValueTask`) should have names that end with "Async". Methods that start an asynchronous operation but do not return an awaitable type should not have names that end with "Async", but may start with "Begin", "Start", or some other verb to suggest this method does not return or throw the result of the operation.
-
- You can ignore the convention where an event, base class, or interface contract suggests a different name. For example, you shouldn’t rename common event handlers, such as `Button1_Click`.
-
-## Related topics and samples (Visual Studio)
-
-|Title|Description|Sample|
-|-----------|-----------------|------------|
-|[Walkthrough: Accessing the Web by Using async and await (C#)](../../../../csharp/programming-guide/concepts/async/walkthrough-accessing-the-web-by-using-async-and-await.md)|Shows how to convert a synchronous WPF solution to an asynchronous WPF solution. The application downloads a series of websites.|[Async Sample: Accessing the Web Walkthrough](https://code.msdn.microsoft.com/Async-Sample-Accessing-the-9c10497f)|
-|[How to: Extend the async Walkthrough by Using Task.WhenAll (C#)](../../../../csharp/programming-guide/concepts/async/how-to-extend-the-async-walkthrough-by-using-task-whenall.md)|Adds to the previous walkthrough. The use of `WhenAll` starts all the downloads at the same time.||
-|[How to: Make Multiple Web Requests in Parallel by Using async and await (C#)](../../../../csharp/programming-guide/concepts/async/how-to-make-multiple-web-requests-in-parallel-by-using-async-and-await.md)|Demonstrates how to start several tasks at the same time.|[Async Sample: Make Multiple Web Requests in Parallel](https://code.msdn.microsoft.com/Async-Make-Multiple-Web-49adb82e)|
-|[Async Return Types (C#)](../../../../csharp/programming-guide/concepts/async/async-return-types.md)|Illustrates the types that async methods can return and explains when each type is appropriate.||
-|[Control Flow in Async Programs (C#)](../../../../csharp/programming-guide/concepts/async/control-flow-in-async-programs.md)|Traces in detail the flow of control through a succession of await expressions in an asynchronous program.|[Async Sample: Control Flow in Async Programs](https://code.msdn.microsoft.com/Async-Sample-Control-Flow-5c804fc0)|
-|[Fine-Tuning Your Async Application (C#)](../../../../csharp/programming-guide/concepts/async/fine-tuning-your-async-application.md)|Shows how to add the following functionality to your async solution:
- [Cancel an Async Task or a List of Tasks (C#)](../../../../csharp/programming-guide/concepts/async/cancel-an-async-task-or-a-list-of-tasks.md)
- [Cancel Async Tasks after a Period of Time (C#)](../../../../csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md)
- [Cancel Remaining Async Tasks after One Is Complete (C#)](../../../../csharp/programming-guide/concepts/async/cancel-remaining-async-tasks-after-one-is-complete.md)
- [Start Multiple Async Tasks and Process Them As They Complete (C#)](../../../../csharp/programming-guide/concepts/async/start-multiple-async-tasks-and-process-them-as-they-complete.md)|[Async Sample: Fine Tuning Your Application](https://code.msdn.microsoft.com/Async-Fine-Tuning-Your-a676abea)|
-|[Handling Reentrancy in Async Apps (C#)](../../../../csharp/programming-guide/concepts/async/handling-reentrancy-in-async-apps.md)|Shows how to handle cases in which an active asynchronous operation is restarted while it’s running.||
-|[WhenAny: Bridging between the .NET Framework and the Windows Runtime](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/jj635140(v=vs.120))|Shows how to bridge between Task types in the .NET Framework and IAsyncOperations in the [!INCLUDE[wrt](~/includes/wrt-md.md)] so that you can use with a [!INCLUDE[wrt](~/includes/wrt-md.md)] method.|[Async Sample: Bridging between .NET and Windows Runtime (AsTask and WhenAny)](https://code.msdn.microsoft.com/Async-Sample-Bridging-d6a2f739)|
-|Async Cancellation: Bridging between the .NET Framework and the Windows Runtime|Shows how to bridge between Task types in the .NET Framework and IAsyncOperations in the [!INCLUDE[wrt](~/includes/wrt-md.md)] so that you can use with a [!INCLUDE[wrt](~/includes/wrt-md.md)] method.|[Async Sample: Bridging between .NET and Windows Runtime (AsTask & Cancellation)](https://code.msdn.microsoft.com/Async-Sample-Bridging-9479eca3)|
-|[Using Async for File Access (C#)](../../../../csharp/programming-guide/concepts/async/using-async-for-file-access.md)|Lists and demonstrates the benefits of using async and await to access files.||
-|[Task-based Asynchronous Pattern (TAP)](../../../../standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap.md)|Describes a new pattern for asynchrony in the .NET Framework. The pattern is based on the and types.||
-|[Async Videos on Channel 9](https://channel9.msdn.com/search?term=async%20&type=All#pubDate=year&ch9Search&lang-en=en)|Provides links to a variety of videos about async programming.||
-
-## Complete example
- The following code is the MainWindow.xaml.cs file from the Windows Presentation Foundation (WPF) application that this topic discusses. You can download the sample from [Async Sample: Example from "Asynchronous Programming with Async and Await"](https://code.msdn.microsoft.com/Async-Sample-Example-from-9b9f505c).
-
-```csharp
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-// Add a using directive and a reference for System.Net.Http;
-using System.Net.Http;
-
-namespace AsyncFirstExample
-{
- public partial class MainWindow : Window
- {
- // Mark the event handler with async so you can use await in it.
- private async void StartButton_Click(object sender, RoutedEventArgs e)
- {
- // Call and await separately.
- //Task getLengthTask = AccessTheWebAsync();
- //// You can do independent work here.
- //int contentLength = await getLengthTask;
-
- int contentLength = await AccessTheWebAsync();
-
+
+You can ignore the convention where an event, base class, or interface contract suggests a different name. For example, you shouldn’t rename common event handlers, such as `Button1_Click`.
+
+## Related topics and samples (Visual Studio)
+
+|Title|Description|Sample|
+|-----------|-----------------|------------|
+|[Walkthrough: Accessing the Web by Using async and await (C#)](../../../../csharp/programming-guide/concepts/async/walkthrough-accessing-the-web-by-using-async-and-await.md)|Shows how to convert a synchronous WPF solution to an asynchronous WPF solution. The application downloads a series of websites.|[Async Sample: Accessing the Web Walkthrough](https://code.msdn.microsoft.com/Async-Sample-Accessing-the-9c10497f)|
+|[How to: Extend the async Walkthrough by Using Task.WhenAll (C#)](../../../../csharp/programming-guide/concepts/async/how-to-extend-the-async-walkthrough-by-using-task-whenall.md)|Adds to the previous walkthrough. The use of `WhenAll` starts all the downloads at the same time.||
+|[How to: Make Multiple Web Requests in Parallel by Using async and await (C#)](../../../../csharp/programming-guide/concepts/async/how-to-make-multiple-web-requests-in-parallel-by-using-async-and-await.md)|Demonstrates how to start several tasks at the same time.|[Async Sample: Make Multiple Web Requests in Parallel](https://code.msdn.microsoft.com/Async-Make-Multiple-Web-49adb82e)|
+|[Async Return Types (C#)](../../../../csharp/programming-guide/concepts/async/async-return-types.md)|Illustrates the types that async methods can return and explains when each type is appropriate.||
+|[Control Flow in Async Programs (C#)](../../../../csharp/programming-guide/concepts/async/control-flow-in-async-programs.md)|Traces in detail the flow of control through a succession of await expressions in an asynchronous program.|[Async Sample: Control Flow in Async Programs](https://code.msdn.microsoft.com/Async-Sample-Control-Flow-5c804fc0)|
+|[Fine-Tuning Your Async Application (C#)](../../../../csharp/programming-guide/concepts/async/fine-tuning-your-async-application.md)|Shows how to add the following functionality to your async solution:
- [Cancel an Async Task or a List of Tasks (C#)](../../../../csharp/programming-guide/concepts/async/cancel-an-async-task-or-a-list-of-tasks.md)
- [Cancel Async Tasks after a Period of Time (C#)](../../../../csharp/programming-guide/concepts/async/cancel-async-tasks-after-a-period-of-time.md)
- [Cancel Remaining Async Tasks after One Is Complete (C#)](../../../../csharp/programming-guide/concepts/async/cancel-remaining-async-tasks-after-one-is-complete.md)
- [Start Multiple Async Tasks and Process Them As They Complete (C#)](../../../../csharp/programming-guide/concepts/async/start-multiple-async-tasks-and-process-them-as-they-complete.md)|[Async Sample: Fine Tuning Your Application](https://code.msdn.microsoft.com/Async-Fine-Tuning-Your-a676abea)|
+|[Handling Reentrancy in Async Apps (C#)](../../../../csharp/programming-guide/concepts/async/handling-reentrancy-in-async-apps.md)|Shows how to handle cases in which an active asynchronous operation is restarted while it’s running.||
+|[WhenAny: Bridging between the .NET Framework and the Windows Runtime](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/jj635140(v=vs.120))|Shows how to bridge between Task types in the .NET Framework and IAsyncOperations in the [!INCLUDE[wrt](~/includes/wrt-md.md)] so that you can use with a [!INCLUDE[wrt](~/includes/wrt-md.md)] method.|[Async Sample: Bridging between .NET and Windows Runtime (AsTask and WhenAny)](https://code.msdn.microsoft.com/Async-Sample-Bridging-d6a2f739)|
+|Async Cancellation: Bridging between the .NET Framework and the Windows Runtime|Shows how to bridge between Task types in the .NET Framework and IAsyncOperations in the [!INCLUDE[wrt](~/includes/wrt-md.md)] so that you can use with a [!INCLUDE[wrt](~/includes/wrt-md.md)] method.|[Async Sample: Bridging between .NET and Windows Runtime (AsTask & Cancellation)](https://code.msdn.microsoft.com/Async-Sample-Bridging-9479eca3)|
+|[Using Async for File Access (C#)](../../../../csharp/programming-guide/concepts/async/using-async-for-file-access.md)|Lists and demonstrates the benefits of using async and await to access files.||
+|[Task-based Asynchronous Pattern (TAP)](../../../../standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap.md)|Describes a new pattern for asynchrony in the .NET Framework. The pattern is based on the and types.||
+|[Async Videos on Channel 9](https://channel9.msdn.com/search?term=async%20&type=All#pubDate=year&ch9Search&lang-en=en)|Provides links to a variety of videos about async programming.||
+
+## Complete example
+
+The following code is the MainWindow.xaml.cs file from the Windows Presentation Foundation (WPF) application that this topic discusses. You can download the sample from [Async Sample: Example from "Asynchronous Programming with Async and Await"](https://code.msdn.microsoft.com/Async-Sample-Example-from-9b9f505c).
+
+```csharp
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+// Add a using directive and a reference for System.Net.Http;
+using System.Net.Http;
+
+namespace AsyncFirstExample
+{
+ public partial class MainWindow : Window
+ {
+ // Mark the event handler with async so you can use await in it.
+ private async void StartButton_Click(object sender, RoutedEventArgs e)
+ {
+ // Call and await separately.
+ //Task getLengthTask = AccessTheWebAsync();
+ //// You can do independent work here.
+ //int contentLength = await getLengthTask;
+
+ int contentLength = await AccessTheWebAsync();
+
resultsTextBox.Text +=
$"\r\nLength of the downloaded string: {contentLength}.\r\n";
- }
-
- // Three things to note in the signature:
- // - The method has an async modifier.
- // - The return type is Task or Task. (See "Return Types" section.)
- // Here, it is Task because the return statement returns an integer.
- // - The method name ends in "Async."
- async Task AccessTheWebAsync()
- {
- // You need to add a reference to System.Net.Http to declare client.
- using (HttpClient client = new HttpClient())
- {
- // GetStringAsync returns a Task. That means that when you await the
- // task you'll get a string (urlContents).
- Task getStringTask = client.GetStringAsync("https://docs.microsoft.com");
-
- // You can do work here that doesn't rely on the string from GetStringAsync.
- DoIndependentWork();
-
- // The await operator suspends AccessTheWebAsync.
- // - AccessTheWebAsync can't continue until getStringTask is complete.
- // - Meanwhile, control returns to the caller of AccessTheWebAsync.
- // - Control resumes here when getStringTask is complete.
- // - The await operator then retrieves the string result from getStringTask.
- string urlContents = await getStringTask;
-
- // The return statement specifies an integer result.
- // Any methods that are awaiting AccessTheWebAsync retrieve the length value.
- return urlContents.Length;
- }
- }
-
- void DoIndependentWork()
- {
- resultsTextBox.Text += "Working . . . . . . .\r\n";
- }
- }
-}
-
-// Sample Output:
-
-// Working . . . . . . .
-
-// Length of the downloaded string: 25035.
-```
-
+ }
+
+ // Three things to note in the signature:
+ // - The method has an async modifier.
+ // - The return type is Task or Task. (See "Return Types" section.)
+ // Here, it is Task because the return statement returns an integer.
+ // - The method name ends in "Async."
+ async Task AccessTheWebAsync()
+ {
+ // You need to add a reference to System.Net.Http to declare client.
+ using (HttpClient client = new HttpClient())
+ {
+ // GetStringAsync returns a Task. That means that when you await the
+ // task you'll get a string (urlContents).
+ Task getStringTask = client.GetStringAsync("https://docs.microsoft.com");
+
+ // You can do work here that doesn't rely on the string from GetStringAsync.
+ DoIndependentWork();
+
+ // The await operator suspends AccessTheWebAsync.
+ // - AccessTheWebAsync can't continue until getStringTask is complete.
+ // - Meanwhile, control returns to the caller of AccessTheWebAsync.
+ // - Control resumes here when getStringTask is complete.
+ // - The await operator then retrieves the string result from getStringTask.
+ string urlContents = await getStringTask;
+
+ // The return statement specifies an integer result.
+ // Any methods that are awaiting AccessTheWebAsync retrieve the length value.
+ return urlContents.Length;
+ }
+ }
+
+ void DoIndependentWork()
+ {
+ resultsTextBox.Text += "Working . . . . . . .\r\n";
+ }
+ }
+}
+
+// Sample Output:
+
+// Working . . . . . . .
+
+// Length of the downloaded string: 25035.
+```
+
## See also
- [async](../../../../csharp/language-reference/keywords/async.md)
diff --git a/docs/csharp/programming-guide/statements-expressions-operators/index.md b/docs/csharp/programming-guide/statements-expressions-operators/index.md
index 8320cb2d093aa..b3e0438758396 100644
--- a/docs/csharp/programming-guide/statements-expressions-operators/index.md
+++ b/docs/csharp/programming-guide/statements-expressions-operators/index.md
@@ -2,7 +2,7 @@
title: "Statements, Expressions, and Operators - C# Programming Guide"
ms.custom: seodec18
ms.date: 07/20/2015
-helpviewer_keywords:
+helpviewer_keywords:
- "expressions [C#]"
- "operators [C#]"
- "C# language, statements"
@@ -12,33 +12,35 @@ helpviewer_keywords:
ms.assetid: 20f8469d-5a6a-4084-ad90-0856b7e97e45
---
# Statements, Expressions, and Operators (C# Programming Guide)
-The C# code that comprises an application consists of statements made up of keywords, expressions and operators. This section contains information regarding these fundamental elements of a C# program.
-
- For more information, see:
-
-- [Statements](statements.md)
-
-- [Expressions](expressions.md)
-
- - [Expression-bodied members](expression-bodied-members.md)
-
-- [Operators](operators.md)
-
-- [Anonymous Functions](anonymous-functions.md)
-
-- [Overloadable Operators](overloadable-operators.md)
-
-- [Conversion Operators](conversion-operators.md)
-
- - [Using Conversion Operators](using-conversion-operators.md)
-
- - [How to: Implement User-Defined Conversions Between Structs](how-to-implement-user-defined-conversions-between-structs.md)
-
-- [Equality Comparisons](equality-comparisons.md)
-
-## C# Language Specification
- [!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)]
-
+
+The C# code that comprises an application consists of statements made up of keywords, expressions and operators. This section contains information regarding these fundamental elements of a C# program.
+
+ For more information, see:
+
+- [Statements](statements.md)
+
+- [Expressions](expressions.md)
+
+ - [Expression-bodied members](expression-bodied-members.md)
+
+- [Operators](operators.md)
+
+- [Anonymous Functions](anonymous-functions.md)
+
+- [Overloadable Operators](overloadable-operators.md)
+
+- [Conversion Operators](conversion-operators.md)
+
+ - [Using Conversion Operators](using-conversion-operators.md)
+
+ - [How to: Implement User-Defined Conversions Between Structs](how-to-implement-user-defined-conversions-between-structs.md)
+
+- [Equality Comparisons](equality-comparisons.md)
+
+## C# Language Specification
+
+[!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)]
+
## See also
- [C# Programming Guide](../../../csharp/programming-guide/index.md)
diff --git a/docs/csharp/programming-guide/xmldoc/processing-the-xml-file.md b/docs/csharp/programming-guide/xmldoc/processing-the-xml-file.md
index b70451cef8ae2..4415385fe4515 100644
--- a/docs/csharp/programming-guide/xmldoc/processing-the-xml-file.md
+++ b/docs/csharp/programming-guide/xmldoc/processing-the-xml-file.md
@@ -2,79 +2,81 @@
title: "Processing the XML File - C# Programming Guide"
ms.custom: seodec18
ms.date: 07/20/2015
-helpviewer_keywords:
+helpviewer_keywords:
- "XML processing [C#]"
- "XML [C#], processing"
ms.assetid: 60c71193-9dac-4cd3-98c5-100bd0edcc42
---
# Processing the XML File (C# Programming Guide)
-The compiler generates an ID string for each construct in your code that is tagged to generate documentation. (For information about how to tag your code, see [Recommended Tags for Documentation Comments](../../../csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments.md).) The ID string uniquely identifies the construct. Programs that process the XML file can use the ID string to identify the corresponding .NET Framework metadata/reflection item that the documentation applies to.
-
- The XML file is not a hierarchical representation of your code; it is a flat list that has a generated ID for each element.
-
- The compiler observes the following rules when it generates the ID strings:
-
-- No white space is in the string.
-
-- The first part of the ID string identifies the kind of member being identified, by way of a single character followed by a colon. The following member types are used:
-
- |Character|Description|
- |---------------|-----------------|
- |N|namespace
You cannot add documentation comments to a namespace, but you can make cref references to them, where supported.|
- |T|type: class, interface, struct, enum, delegate|
- |F|field|
- |P|property (including indexers or other indexed properties)|
- |M|method (including such special methods as constructors, operators, and so forth)|
- |E|event|
- |!|error string
The rest of the string provides information about the error. The C# compiler generates error information for links that cannot be resolved.|
-
-- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they are replaced by the hash-sign ('#'). It is assumed that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor would be "System.String.#ctor".
-
-- For properties and methods, if there are arguments to the method, the argument list enclosed in parentheses follows. If there are no arguments, no parentheses are present. The arguments are separated by commas. The encoding of each argument follows directly how it is encoded in a .NET Framework signature:
-
- - Base types. Regular types (ELEMENT_TYPE_CLASS or ELEMENT_TYPE_VALUETYPE) are represented as the fully qualified name of the type.
-
- - Intrinsic types (for example, ELEMENT_TYPE_I4, ELEMENT_TYPE_OBJECT, ELEMENT_TYPE_STRING, ELEMENT_TYPE_TYPEDBYREF. and ELEMENT_TYPE_VOID) are represented as the fully qualified name of the corresponding full type. For example, System.Int32 or System.TypedReference.
-
- - ELEMENT_TYPE_PTR is represented as a '\*' following the modified type.
-
- - ELEMENT_TYPE_BYREF is represented as a '\@' following the modified type.
-
- - ELEMENT_TYPE_PINNED is represented as a '^' following the modified type. The C# compiler never generates this.
-
- - ELEMENT_TYPE_CMOD_REQ is represented as a '|' and the fully qualified name of the modifier class, following the modified type. The C# compiler never generates this.
-
- - ELEMENT_TYPE_CMOD_OPT is represented as a '!' and the fully qualified name of the modifier class, following the modified type.
-
- - ELEMENT_TYPE_SZARRAY is represented as "[]" following the element type of the array.
-
- - ELEMENT_TYPE_GENERICARRAY is represented as "[?]" following the element type of the array. The C# compiler never generates this.
-
- - ELEMENT_TYPE_ARRAY is represented as [*lowerbound*:`size`,*lowerbound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. If a lower bound or size is not specified, it is simply omitted. If the lower bound and size for a particular dimension are omitted, the ':' is omitted as well. For example, a 2-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:].
-
- - ELEMENT_TYPE_FNPTR is represented as "=FUNC:`type`(*signature*)", where `type` is the return type, and *signature* is the arguments of the method. If there are no arguments, the parentheses are omitted. The C# compiler never generates this.
-
- The following signature components are not represented because they are never used for differentiating overloaded methods:
-
- - calling convention
-
- - return type
-
- - ELEMENT_TYPE_SENTINEL
-
-- For conversion operators only (op_Implicit and op_Explicit), the return value of the method is encoded as a '~' followed by the return type, as encoded above.
-
-- For generic types, the name of the type is followed by a backtick and then a number that indicates the number of generic type parameters. For example:
-
- ```` is the tag for a type that is defined as `public class SampleClass`.
-
- For methods taking generic types as parameters, the generic type parameters are specified as numbers prefaced with backticks (for example \`0,\`1). Each number representing a zero-based array notation for the type's generic parameters.
-
-## Examples
- The following examples show how the ID strings for a class and its members would be generated:
-
- [!code-csharp[csProgGuidePointers#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuidePointers/CS/Pointers.cs#21)]
-
+
+The compiler generates an ID string for each construct in your code that is tagged to generate documentation. (For information about how to tag your code, see [Recommended Tags for Documentation Comments](../../../csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments.md).) The ID string uniquely identifies the construct. Programs that process the XML file can use the ID string to identify the corresponding .NET Framework metadata/reflection item that the documentation applies to.
+
+ The XML file is not a hierarchical representation of your code; it is a flat list that has a generated ID for each element.
+
+ The compiler observes the following rules when it generates the ID strings:
+
+- No white space is in the string.
+
+- The first part of the ID string identifies the kind of member being identified, by way of a single character followed by a colon. The following member types are used:
+
+ |Character|Description|
+ |---------------|-----------------|
+ |N|namespace
You cannot add documentation comments to a namespace, but you can make cref references to them, where supported.|
+ |T|type: class, interface, struct, enum, delegate|
+ |F|field|
+ |P|property (including indexers or other indexed properties)|
+ |M|method (including such special methods as constructors, operators, and so forth)|
+ |E|event|
+ |!|error string
The rest of the string provides information about the error. The C# compiler generates error information for links that cannot be resolved.|
+
+- The second part of the string is the fully qualified name of the item, starting at the root of the namespace. The name of the item, its enclosing type(s), and namespace are separated by periods. If the name of the item itself has periods, they are replaced by the hash-sign ('#'). It is assumed that no item has a hash-sign directly in its name. For example, the fully qualified name of the String constructor would be "System.String.#ctor".
+
+- For properties and methods, if there are arguments to the method, the argument list enclosed in parentheses follows. If there are no arguments, no parentheses are present. The arguments are separated by commas. The encoding of each argument follows directly how it is encoded in a .NET Framework signature:
+
+ - Base types. Regular types (ELEMENT_TYPE_CLASS or ELEMENT_TYPE_VALUETYPE) are represented as the fully qualified name of the type.
+
+ - Intrinsic types (for example, ELEMENT_TYPE_I4, ELEMENT_TYPE_OBJECT, ELEMENT_TYPE_STRING, ELEMENT_TYPE_TYPEDBYREF. and ELEMENT_TYPE_VOID) are represented as the fully qualified name of the corresponding full type. For example, System.Int32 or System.TypedReference.
+
+ - ELEMENT_TYPE_PTR is represented as a '\*' following the modified type.
+
+ - ELEMENT_TYPE_BYREF is represented as a '\@' following the modified type.
+
+ - ELEMENT_TYPE_PINNED is represented as a '^' following the modified type. The C# compiler never generates this.
+
+ - ELEMENT_TYPE_CMOD_REQ is represented as a '|' and the fully qualified name of the modifier class, following the modified type. The C# compiler never generates this.
+
+ - ELEMENT_TYPE_CMOD_OPT is represented as a '!' and the fully qualified name of the modifier class, following the modified type.
+
+ - ELEMENT_TYPE_SZARRAY is represented as "[]" following the element type of the array.
+
+ - ELEMENT_TYPE_GENERICARRAY is represented as "[?]" following the element type of the array. The C# compiler never generates this.
+
+ - ELEMENT_TYPE_ARRAY is represented as [*lowerbound*:`size`,*lowerbound*:`size`] where the number of commas is the rank - 1, and the lower bounds and size of each dimension, if known, are represented in decimal. If a lower bound or size is not specified, it is simply omitted. If the lower bound and size for a particular dimension are omitted, the ':' is omitted as well. For example, a 2-dimensional array with 1 as the lower bounds and unspecified sizes is [1:,1:].
+
+ - ELEMENT_TYPE_FNPTR is represented as "=FUNC:`type`(*signature*)", where `type` is the return type, and *signature* is the arguments of the method. If there are no arguments, the parentheses are omitted. The C# compiler never generates this.
+
+ The following signature components are not represented because they are never used for differentiating overloaded methods:
+
+ - calling convention
+
+ - return type
+
+ - ELEMENT_TYPE_SENTINEL
+
+- For conversion operators only (op_Implicit and op_Explicit), the return value of the method is encoded as a '~' followed by the return type, as encoded above.
+
+- For generic types, the name of the type is followed by a backtick and then a number that indicates the number of generic type parameters. For example:
+
+ ```` is the tag for a type that is defined as `public class SampleClass`.
+
+ For methods taking generic types as parameters, the generic type parameters are specified as numbers prefaced with backticks (for example \`0,\`1). Each number representing a zero-based array notation for the type's generic parameters.
+
+## Examples
+
+The following examples show how the ID strings for a class and its members would be generated:
+
+[!code-csharp[csProgGuidePointers#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuidePointers/CS/Pointers.cs#21)]
+
## See also
- [C# Programming Guide](../../../csharp/programming-guide/index.md)
diff --git a/docs/csharp/tour-of-csharp/classes-and-objects.md b/docs/csharp/tour-of-csharp/classes-and-objects.md
index 0ba150e886145..52ffc27d2b775 100644
--- a/docs/csharp/tour-of-csharp/classes-and-objects.md
+++ b/docs/csharp/tour-of-csharp/classes-and-objects.md
@@ -28,42 +28,42 @@ The members of a class are either static members or instance members. Static mem
The following provides an overview of the kinds of members a class can contain.
* Constants
- - Constant values associated with the class
+ - Constant values associated with the class
* Fields
- - Variables of the class
+ - Variables of the class
* Methods
- - Computations and actions that can be performed by the class
+ - Computations and actions that can be performed by the class
* Properties
- - Actions associated with reading and writing named properties of the class
+ - Actions associated with reading and writing named properties of the class
* Indexers
- - Actions associated with indexing instances of the class like an array
+ - Actions associated with indexing instances of the class like an array
* Events
- - Notifications that can be generated by the class
+ - Notifications that can be generated by the class
* Operators
- - Conversions and expression operators supported by the class
+ - Conversions and expression operators supported by the class
* Constructors
- - Actions required to initialize instances of the class or the class itself
+ - Actions required to initialize instances of the class or the class itself
* Finalizers
- - Actions to perform before instances of the class are permanently discarded
+ - Actions to perform before instances of the class are permanently discarded
* Types
- - Nested types declared by the class
+ - Nested types declared by the class
## Accessibility
Each member of a class has an associated accessibility, which controls the regions of program text that are able to access the member. There are six possible forms of accessibility. These are summarized below.
* `public`
- - Access not limited
+ - Access not limited
* `protected`
- - Access limited to this class or classes derived from this class
+ - Access limited to this class or classes derived from this class
* `internal`
- - Access limited to the current assembly (.exe, .dll, etc.)
+ - Access limited to the current assembly (.exe, .dll, etc.)
* `protected internal`
- - Access limited to the containing class, classes derived from the containing class, or classes within the same assembly
+ - Access limited to the containing class, classes derived from the containing class, or classes within the same assembly
* `private`
- - Access limited to this class
+ - Access limited to this class
* `private protected`
- - Access limited to the containing class or classes derived from the containing type within the same assembly
+ - Access limited to the containing class or classes derived from the containing type within the same assembly
## Type parameters
diff --git a/docs/csharp/tutorials/working-with-linq.md b/docs/csharp/tutorials/working-with-linq.md
index f3e3c5e3e3a6c..387d1eba2dc20 100644
--- a/docs/csharp/tutorials/working-with-linq.md
+++ b/docs/csharp/tutorials/working-with-linq.md
@@ -335,9 +335,9 @@ Aside from LINQ, you learned a bit about a technique magicians use for card tric
For more information on LINQ, see:
- [Language Integrated Query (LINQ)](../programming-guide/concepts/linq/index.md)
- - [Introduction to LINQ](../programming-guide/concepts/linq/introduction-to-linq.md)
- - [Getting Started With LINQ in C#](../programming-guide/concepts/linq/getting-started-with-linq.md)
- - [Basic LINQ Query Operations (C#)](../programming-guide/concepts/linq/basic-linq-query-operations.md)
- - [Data Transformations With LINQ (C#)](../programming-guide/concepts/linq/data-transformations-with-linq.md)
- - [Query Syntax and Method Syntax in LINQ (C#)](../programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md)
- - [C# Features That Support LINQ](../programming-guide/concepts/linq/features-that-support-linq.md)
+ - [Introduction to LINQ](../programming-guide/concepts/linq/introduction-to-linq.md)
+ - [Getting Started With LINQ in C#](../programming-guide/concepts/linq/getting-started-with-linq.md)
+ - [Basic LINQ Query Operations (C#)](../programming-guide/concepts/linq/basic-linq-query-operations.md)
+ - [Data Transformations With LINQ (C#)](../programming-guide/concepts/linq/data-transformations-with-linq.md)
+ - [Query Syntax and Method Syntax in LINQ (C#)](../programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md)
+ - [C# Features That Support LINQ](../programming-guide/concepts/linq/features-that-support-linq.md)
diff --git a/docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md b/docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md
index a2f761e183d1e..52980e5d93326 100644
--- a/docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md
+++ b/docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md
@@ -80,9 +80,9 @@ DbNewInstanceExpression can only occur in the following two cases:
- As the Projection property of DbProjectExpression. When used as such the following restrictions apply:
- - The result type must be a row type.
+ - The result type must be a row type.
- - Each of its arguments is an expression that produces a result with a primitive type. Typically, each argument is a scalar expression, like a PropertyExpression over a DbVariableReferenceExpression, a function invocation, or an arithmetic computation of the DbPropertyExpression over a DbVariableReferenceExpression or a function invocation. However, an expression representing a scalar subquery can also occur in the list of arguments for a DbNewInstanceExpression. An expression that represents a scalar subquery is an expression tree that represents a subquery that returns exactly one row and one column of a primitive type with a DbElementExpression object root
+ - Each of its arguments is an expression that produces a result with a primitive type. Typically, each argument is a scalar expression, like a PropertyExpression over a DbVariableReferenceExpression, a function invocation, or an arithmetic computation of the DbPropertyExpression over a DbVariableReferenceExpression or a function invocation. However, an expression representing a scalar subquery can also occur in the list of arguments for a DbNewInstanceExpression. An expression that represents a scalar subquery is an expression tree that represents a subquery that returns exactly one row and one column of a primitive type with a DbElementExpression object root
- With a collection return type, in which case it defines a new collection of the expressions provided as arguments.
diff --git a/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md b/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md
index 27217839d30e5..12bd4e673fff5 100644
--- a/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md
+++ b/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md
@@ -18,35 +18,35 @@ The following example describes how to configure row-level filtering based on a
- Enable row-level filtering:
- - If you are using SQL Server 2016 or higher, or [Azure SQL Database](https://docs.microsoft.com/azure/sql-database/), create a security policy that adds a predicate on the table restricting the rows returned to those that match either the current database user (using the CURRENT_USER() built-in function) or the current login name (using the SUSER_SNAME() built-in function):
-
- ```sql
- CREATE SCHEMA Security
- GO
-
- CREATE FUNCTION Security.userAccessPredicate(@UserName sysname)
- RETURNS TABLE
- WITH SCHEMABINDING
- AS
- RETURN SELECT 1 AS accessResult
- WHERE @UserName = SUSER_SNAME()
- GO
-
- CREATE SECURITY POLICY Security.userAccessPolicy
- ADD FILTER PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable,
- ADD BLOCK PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable
- GO
- ```
-
- - If you are using a version of SQL Server prior to 2016, you can achieve similar functionality using a view:
-
- ```sql
- CREATE VIEW vw_MyTable
- AS
- RETURN SELECT * FROM MyTable
- WHERE UserName = SUSER_SNAME()
- GO
- ```
+ - If you are using SQL Server 2016 or higher, or [Azure SQL Database](https://docs.microsoft.com/azure/sql-database/), create a security policy that adds a predicate on the table restricting the rows returned to those that match either the current database user (using the CURRENT_USER() built-in function) or the current login name (using the SUSER_SNAME() built-in function):
+
+ ```sql
+ CREATE SCHEMA Security
+ GO
+
+ CREATE FUNCTION Security.userAccessPredicate(@UserName sysname)
+ RETURNS TABLE
+ WITH SCHEMABINDING
+ AS
+ RETURN SELECT 1 AS accessResult
+ WHERE @UserName = SUSER_SNAME()
+ GO
+
+ CREATE SECURITY POLICY Security.userAccessPolicy
+ ADD FILTER PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable,
+ ADD BLOCK PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable
+ GO
+ ```
+
+ - If you are using a version of SQL Server prior to 2016, you can achieve similar functionality using a view:
+
+ ```sql
+ CREATE VIEW vw_MyTable
+ AS
+ RETURN SELECT * FROM MyTable
+ WHERE UserName = SUSER_SNAME()
+ GO
+ ```
- Create stored procedures to select, insert, update, and delete data. If the filtering is enacted by a security policy, the stored procedures should perform these operations on the base table directly; otherwise, if the filtering is enacted by a view, the stored procedures should instead operate against the view. The security policy or view will automatically filter the rows returned or modified by user queries, and the stored procedure will provide a harder security boundary to prevent users with direct query access from successfully running queries that can infer the existence of filtered data.
diff --git a/docs/framework/data/adonet/sql/linq/data-binding.md b/docs/framework/data/adonet/sql/linq/data-binding.md
index 46b4b73080a07..e30ba3eef4134 100644
--- a/docs/framework/data/adonet/sql/linq/data-binding.md
+++ b/docs/framework/data/adonet/sql/linq/data-binding.md
@@ -37,9 +37,9 @@ Collection generations are implemented by generic . There are two scenarios:
- - If [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] finds the underlying from the , the source allows for edition and the situation is the same as in the first bullet point.
+ - If [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] finds the underlying from the , the source allows for edition and the situation is the same as in the first bullet point.
- - If [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] cannot find the underlying , the source does not allow for edition (for example, `groupby`). [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] browses the query to fill a generic `SortableBindingList`, which is a simple that implements the sorting feature for T entities for a given property.
+ - If [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] cannot find the underlying , the source does not allow for edition (for example, `groupby`). [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] browses the query to fill a generic `SortableBindingList`, which is a simple that implements the sorting feature for T entities for a given property.
## Specialized Collections
diff --git a/docs/framework/data/adonet/sql/linq/numeric-and-comparison-operators.md b/docs/framework/data/adonet/sql/linq/numeric-and-comparison-operators.md
index d5a4f1a436ef3..875385455a90a 100644
--- a/docs/framework/data/adonet/sql/linq/numeric-and-comparison-operators.md
+++ b/docs/framework/data/adonet/sql/linq/numeric-and-comparison-operators.md
@@ -4,53 +4,55 @@ ms.date: "03/30/2017"
ms.assetid: 25b4a26a-06f2-4f80-87a9-76705ed46197
---
# Numeric and Comparison Operators
-Arithmetic and comparison operators work as expected in the common language runtime (CLR) except as follows:
-
-- SQL does not support the modulus operator on floating-point numbers.
-
-- SQL does not support unchecked arithmetic.
-
-- Increment and decrement operators cause side-effects when you use them in expressions that cannot be replicated in SQL and are, therefore, not supported.
-
-## Supported Operators
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] supports the following operators.
-
-- Basic arithmetic operators:
-
- - `+`
-
- - `-` (subtraction)
-
- - `*`
-
- - `/`
-
- - Visual Basic integer division (`\`)
-
- - `%` (Visual Basic `Mod`)
-
- - `<<`
-
- - `>>`
-
- - `-` (unary negation)
-
-- Basic comparison operators:
-
- - Visual Basic `=` and C# `==`
-
- - Visual Basic `<>` and C# `!=`
-
- - Visual Basic `Is/IsNot`
-
- - `<`
-
- - `<=`
-
- - `>`
-
- - `>=`
-
+
+Arithmetic and comparison operators work as expected in the common language runtime (CLR) except as follows:
+
+- SQL does not support the modulus operator on floating-point numbers.
+
+- SQL does not support unchecked arithmetic.
+
+- Increment and decrement operators cause side-effects when you use them in expressions that cannot be replicated in SQL and are, therefore, not supported.
+
+## Supported Operators
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] supports the following operators.
+
+- Basic arithmetic operators:
+
+ - `+`
+
+ - `-` (subtraction)
+
+ - `*`
+
+ - `/`
+
+ - Visual Basic integer division (`\`)
+
+ - `%` (Visual Basic `Mod`)
+
+ - `<<`
+
+ - `>>`
+
+ - `-` (unary negation)
+
+- Basic comparison operators:
+
+ - Visual Basic `=` and C# `==`
+
+ - Visual Basic `<>` and C# `!=`
+
+ - Visual Basic `Is/IsNot`
+
+ - `<`
+
+ - `<=`
+
+ - `>`
+
+ - `>=`
+
## See also
- [Data Types and Functions](../../../../../../docs/framework/data/adonet/sql/linq/data-types-and-functions.md)
diff --git a/docs/framework/data/adonet/sql/linq/sql-clr-type-mismatches.md b/docs/framework/data/adonet/sql/linq/sql-clr-type-mismatches.md
index 9a6b86204afd2..eb83c9abff082 100644
--- a/docs/framework/data/adonet/sql/linq/sql-clr-type-mismatches.md
+++ b/docs/framework/data/adonet/sql/linq/sql-clr-type-mismatches.md
@@ -1,292 +1,304 @@
---
title: "SQL-CLR Type Mismatches"
ms.date: "03/30/2017"
-dev_langs:
+dev_langs:
- "csharp"
- "vb"
ms.assetid: 0a90c33f-7ed7-4501-ad5f-6224c5da8e9b
---
# SQL-CLR Type Mismatches
-[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] automates much of the translation between the object model and SQL Server. Nevertheless, some situations prevent exact translation. These key mismatches between the common language runtime (CLR) types and the SQL Server database types are summarized in the following sections. You can find more details about specific type mappings and function translation at [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md) and [Data Types and Functions](../../../../../../docs/framework/data/adonet/sql/linq/data-types-and-functions.md).
-
-## Data Types
- Translation between the CLR and SQL Server occurs when a query is being sent to the database, and when the results are sent back to your object model. For example, the following Transact-SQL query requires two value conversions:
-
-```
-Select DateOfBirth From Customer Where CustomerId = @id
-```
-
- Before the query can be executed on SQL Server, the value for the Transact-SQL parameter must be specified. In this example, the `id` parameter value must first be translated from a CLR type to a SQL Server `INT` type so that the database can understand what the value is. Then to retrieve the results, the SQL Server `DateOfBirth` column must be translated from a SQL Server `DATETIME` type to a CLR type for use in the object model. In this example, the types in the CLR object model and SQL Server database have natural mappings. But, this is not always the case.
-
-### Missing Counterparts
- The following types do not have reasonable counterparts.
-
-- Mismatches in the CLR namespace:
-
- - **Unsigned integers**. These types are typically mapped to their signed counterparts of larger size to avoid overflow. Literals can be converted to a signed numeric of the same or smaller size, based on value.
-
- - **Boolean**. These types can be mapped to a bit or larger numeric or string. A literal can be mapped to an expression that evaluates to the same value (for example, `1=1` in SQL for `True` in CLS).
-
- - **TimeSpan**. This type represents the difference between two `DateTime` values and does not correspond to the `timestamp` of SQL Server. The CLR may also map to the SQL Server `TIME` type in some cases. The SQL Server `TIME` type was only intended to represent positive values less than 24 hours. The CLR has a much larger range.
-
- > [!NOTE]
- > SQL Server-specific [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] types in are not included in this comparison.
-
-- Mismatches in SQL Server:
-
- - **Fixed length character types**. Transact-SQL distinguishes between Unicode and non-Unicode categories and has three distinct types in each category: fixed length `nchar`/`char`, variable length `nvarchar`/`varchar`, and larger-sized `ntext`/`text`. The fixed length character types could be mapped to the CLR type for retrieving characters, but they do not really correspond to the same type in conversions and behavior.
-
- - **Bit**. Although the `bit` domain has the same number of values as `Nullable`, the two are different types. `Bit` takes values `1` and `0` instead of `true`/`false`, and cannot be used as an equivalent to Boolean expressions.
-
- - **Timestamp**. Unlike the CLR type, the SQL Server `TIMESTAMP` type represents an 8-byte number generated by the database that is unique for each update and is not based on the difference between values.
-
- - **Money** and **SmallMoney**. These types can be mapped to but are basically different types and are treated as such by server-based functions and conversions.
-
-### Multiple Mappings
- There are many SQL Server data types that you can map to one or more CLR data types. There are also many CLR types that you can map to one or more SQL Server types. Although a mapping may be supported by LINQ to SQL, it does not mean that the two types mapped between the CLR and SQL Server are a perfect match in precision, range, and semantics. Some mappings may include differences in any or all of these dimensions. You can find details about these potential differences for the various mapping possibilities at [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md).
-
-### User-defined Types
- User-defined CLR types are designed to help bridge the type system gap. Nevertheless they surface interesting issues about type versioning. A change in the version on the client might not be matched by a change in the type stored on the database server. Any such change causes another type mismatch where the type semantics might not match and the version gap is likely to become visible. Further complications occur as inheritance hierarchies are refactored in successive versions.
-
-## Expression Semantics
- In addition to the pairwise mismatch between CLR and database types, expressions add complexity to the mismatch. Mismatches in operator semantics, function semantics, implicit type conversion, and precedence rules must be considered.
-
- The following subsections illustrate the mismatch between apparently similar expressions. It might be possible to generate SQL expressions that are semantically equivalent to a given CLR expression. However, it is not clear whether the semantic differences between apparently similar expressions are evident to a CLR user, and therefore whether the changes that are required for semantic equivalence are intended or not. This is an especially critical issue when an expression is evaluated for a set of values. The visibility of the difference might depend on data- and be hard to identify during coding and debugging.
-
-### Null Semantics
- SQL expressions provide three-valued logic for Boolean expressions. The result can be true, false, or null. By contrast, CLR specifies two-valued Boolean result for comparisons involving null values. Consider the following code:
-
- [!code-csharp[DLinqMismatch#2](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#2)]
- [!code-vb[DLinqMismatch#2](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#2)]
-
-```
--- Assume col1 and col2 are integer columns with null values.
--- Assume that ANSI null behavior has not been explicitly
--- turned off.
-Select …
-From …
-Where col1 = col2
--- Evaluates to null, not true and the corresponding row is not
--- selected.
--- To obtain matching behavior (i -> col1, j -> col2) change
--- the query to the following:
-Select …
-From …
-Where
- col1 = col2
-or (col1 is null and col2 is null)
--- (Visual Basic 'Nothing'.)
-```
-
- A similar problem occurs with the assumption about two-valued results.
-
- [!code-csharp[DLinqMismatch#3](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#3)]
- [!code-vb[DLinqMismatch#3](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#3)]
-
-```
--- Assume col1 and col2 are nullable columns.
--- Assume that ANSI null behavior has not been explicitly
--- turned off.
-Select …
-From …
-Where
- col1 = col2
-or col1 != col2
--- Visual Basic: col1 <> col2.
-
--- Excludes the case where the boolean expression evaluates
--- to null. Therefore the where clause does not always
--- evaluate to true.
-```
-
- In the previous case, you can get equivalent behavior in generating SQL, but the translation might not accurately reflect your intention.
-
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not impose C# `null` or Visual Basic `nothing` comparison semantics on SQL. Comparison operators are syntactically translated to their SQL equivalents. The semantics reflect SQL semantics as defined by server or connection settings. Two null values are considered unequal under default SQL Server settings (although you can change the settings to change the semantics). Regardless, [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not consider server settings in query translation.
-
- A comparison with the literal `null` (`nothing`) is translated to the appropriate SQL version (`is null` or `is not null`).
-
- The value of `null` (`nothing`) in collation is defined by SQL Server; [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not change the collation.
-
-### Type Conversion and Promotion
- SQL supports a rich set of implicit conversions in expressions. Similar expressions in C# would require an explicit cast. For example:
-
-- `Nvarchar` and `DateTime` types can be compared in SQL without any explicit casts; C# requires explicit conversion.
-
-- `Decimal` is implicitly converted to `DateTime` in SQL. C# does not allow for an implicit conversion.
-
- Likewise, type precedence in Transact-SQL differs from type precedence in C# because the underlying set of types is different. In fact, there is no clear subset/superset relationship between the precedence lists. For example, comparing an `nvarchar` with a `varchar` causes the implicit conversion of the `varchar` expression to `nvarchar`. The CLR provides no equivalent promotion.
-
- In simple cases, these differences cause CLR expressions with casts to be redundant for a corresponding SQL expression. More importantly, the intermediate results of a SQL expression might be implicitly promoted to a type that has no accurate counterpart in C#, and vice versa. Overall, the testing, debugging, and validation of such expressions adds significant burden on the user.
-
-### Collation
- Transact-SQL supports explicit collations as annotations to character string types. These collations determine the validity of certain comparisons. For example, comparing two columns with different explicit collations is an error. The use of much simplified CTS string type does not cause such errors. Consider the following example:
-
-```
-create table T2 (
- Col1 nvarchar(10),
- Col2 nvarchar(10) collate Latin_general_ci_as
-)
-```
-
- [!code-csharp[DLinqMismatch#4](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#4)]
- [!code-vb[DLinqMismatch#4](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#4)]
-
-```
-Select …
-From …
-Where Col1 = Col2
--- Error, collation conflict.
-```
-
- In effect, the collation subclause creates a *restricted type* that is not substitutable.
-
- Similarly, the sort order can be significantly different across the type systems. This difference affects the sorting of results. is sorted on all 16 bytes by lexicographic order (`IComparable()`), whereas T-SQL compares GUIDs in the following order: node(10-15), clock-seq(8-9), time-high(6-7), time-mid(4-5), time-low(0-3). This ordering was done in SQL 7.0 when NT-generated GUIDs had such an octet order. The approach ensured that GUIDs generated at the same node cluster came together in sequential order according to timestamp. The approach was also useful for building indexes (inserts become appends instead of random IOs). The order was scrambled later in Windows because of privacy concerns, but SQL must maintain compatibility. A workaround is to use instead of .
-
-### Operator and Function Differences
- Operators and functions that are essentially comparable have subtly different semantics. For example:
-
-- C# specifies short circuit semantics based on lexical order of operands for logical operators `&&` and `||`. SQL on the other hand is targeted for set-based queries and therefore provides more freedom for the optimizer to decide the order of execution. Some of the implications include the following:
-
- - Semantically equivalent translation would require "`CASE` … `WHEN` … `THEN`" construct in SQL to avoid reordering of operand execution.
-
- - A loose translation to `AND`/`OR` operators could cause unexpected errors if the C# expression relies on evaluation the second operand being based on the result of the evaluation of the first operand.
-
-- `Round()` function has different semantics in [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] and in T-SQL.
-
-- Starting index for strings is 0 in the CLR but 1 in SQL. Therefore, any function that has index needs index translation.
-
-- The CLR supports modulus (‘%’) operator for floating point numbers but SQL does not.
-
-- The `Like` operator effectively acquires automatic overloads based on implicit conversions. Although the `Like` operator is defined to operate on character string types, implicit conversion from numeric types or `DateTime` types allows for those non-string types to be used with `Like` just as well. In CTS, comparable implicit conversions do not exist. Therefore, additional overloads are needed.
-
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] automates much of the translation between the object model and SQL Server. Nevertheless, some situations prevent exact translation. These key mismatches between the common language runtime (CLR) types and the SQL Server database types are summarized in the following sections. You can find more details about specific type mappings and function translation at [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md) and [Data Types and Functions](../../../../../../docs/framework/data/adonet/sql/linq/data-types-and-functions.md).
+
+## Data Types
+
+Translation between the CLR and SQL Server occurs when a query is being sent to the database, and when the results are sent back to your object model. For example, the following Transact-SQL query requires two value conversions:
+
+```sql
+Select DateOfBirth From Customer Where CustomerId = @id
+```
+
+Before the query can be executed on SQL Server, the value for the Transact-SQL parameter must be specified. In this example, the `id` parameter value must first be translated from a CLR type to a SQL Server `INT` type so that the database can understand what the value is. Then to retrieve the results, the SQL Server `DateOfBirth` column must be translated from a SQL Server `DATETIME` type to a CLR type for use in the object model. In this example, the types in the CLR object model and SQL Server database have natural mappings. But, this is not always the case.
+
+### Missing Counterparts
+
+The following types do not have reasonable counterparts.
+
+- Mismatches in the CLR namespace:
+
+ - **Unsigned integers**. These types are typically mapped to their signed counterparts of larger size to avoid overflow. Literals can be converted to a signed numeric of the same or smaller size, based on value.
+
+ - **Boolean**. These types can be mapped to a bit or larger numeric or string. A literal can be mapped to an expression that evaluates to the same value (for example, `1=1` in SQL for `True` in CLS).
+
+ - **TimeSpan**. This type represents the difference between two `DateTime` values and does not correspond to the `timestamp` of SQL Server. The CLR may also map to the SQL Server `TIME` type in some cases. The SQL Server `TIME` type was only intended to represent positive values less than 24 hours. The CLR has a much larger range.
+
+ > [!NOTE]
+ > SQL Server-specific [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] types in are not included in this comparison.
+
+- Mismatches in SQL Server:
+
+ - **Fixed length character types**. Transact-SQL distinguishes between Unicode and non-Unicode categories and has three distinct types in each category: fixed length `nchar`/`char`, variable length `nvarchar`/`varchar`, and larger-sized `ntext`/`text`. The fixed length character types could be mapped to the CLR type for retrieving characters, but they do not really correspond to the same type in conversions and behavior.
+
+ - **Bit**. Although the `bit` domain has the same number of values as `Nullable`, the two are different types. `Bit` takes values `1` and `0` instead of `true`/`false`, and cannot be used as an equivalent to Boolean expressions.
+
+ - **Timestamp**. Unlike the CLR type, the SQL Server `TIMESTAMP` type represents an 8-byte number generated by the database that is unique for each update and is not based on the difference between values.
+
+ - **Money** and **SmallMoney**. These types can be mapped to but are basically different types and are treated as such by server-based functions and conversions.
+
+### Multiple Mappings
+
+There are many SQL Server data types that you can map to one or more CLR data types. There are also many CLR types that you can map to one or more SQL Server types. Although a mapping may be supported by LINQ to SQL, it does not mean that the two types mapped between the CLR and SQL Server are a perfect match in precision, range, and semantics. Some mappings may include differences in any or all of these dimensions. You can find details about these potential differences for the various mapping possibilities at [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md).
+
+### User-defined Types
+
+User-defined CLR types are designed to help bridge the type system gap. Nevertheless they surface interesting issues about type versioning. A change in the version on the client might not be matched by a change in the type stored on the database server. Any such change causes another type mismatch where the type semantics might not match and the version gap is likely to become visible. Further complications occur as inheritance hierarchies are refactored in successive versions.
+
+## Expression Semantics
+
+In addition to the pairwise mismatch between CLR and database types, expressions add complexity to the mismatch. Mismatches in operator semantics, function semantics, implicit type conversion, and precedence rules must be considered.
+
+The following subsections illustrate the mismatch between apparently similar expressions. It might be possible to generate SQL expressions that are semantically equivalent to a given CLR expression. However, it is not clear whether the semantic differences between apparently similar expressions are evident to a CLR user, and therefore whether the changes that are required for semantic equivalence are intended or not. This is an especially critical issue when an expression is evaluated for a set of values. The visibility of the difference might depend on data- and be hard to identify during coding and debugging.
+
+### Null Semantics
+
+SQL expressions provide three-valued logic for Boolean expressions. The result can be true, false, or null. By contrast, CLR specifies two-valued Boolean result for comparisons involving null values. Consider the following code:
+
+[!code-csharp[DLinqMismatch#2](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#2)]
+[!code-vb[DLinqMismatch#2](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#2)]
+
+```sql
+-- Assume col1 and col2 are integer columns with null values.
+-- Assume that ANSI null behavior has not been explicitly
+-- turned off.
+Select …
+From …
+Where col1 = col2
+-- Evaluates to null, not true and the corresponding row is not
+-- selected.
+-- To obtain matching behavior (i -> col1, j -> col2) change
+-- the query to the following:
+Select …
+From …
+Where
+ col1 = col2
+or (col1 is null and col2 is null)
+-- (Visual Basic 'Nothing'.)
+```
+
+A similar problem occurs with the assumption about two-valued results.
+
+[!code-csharp[DLinqMismatch#3](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#3)]
+[!code-vb[DLinqMismatch#3](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#3)]
+
+```sql
+-- Assume col1 and col2 are nullable columns.
+-- Assume that ANSI null behavior has not been explicitly
+-- turned off.
+Select …
+From …
+Where
+ col1 = col2
+or col1 != col2
+-- Visual Basic: col1 <> col2.
+
+-- Excludes the case where the boolean expression evaluates
+-- to null. Therefore the where clause does not always
+-- evaluate to true.
+```
+
+In the previous case, you can get equivalent behavior in generating SQL, but the translation might not accurately reflect your intention.
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not impose C# `null` or Visual Basic `nothing` comparison semantics on SQL. Comparison operators are syntactically translated to their SQL equivalents. The semantics reflect SQL semantics as defined by server or connection settings. Two null values are considered unequal under default SQL Server settings (although you can change the settings to change the semantics). Regardless, [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not consider server settings in query translation.
+
+A comparison with the literal `null` (`nothing`) is translated to the appropriate SQL version (`is null` or `is not null`).
+
+The value of `null` (`nothing`) in collation is defined by SQL Server; [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not change the collation.
+
+### Type Conversion and Promotion
+
+SQL supports a rich set of implicit conversions in expressions. Similar expressions in C# would require an explicit cast. For example:
+
+- `Nvarchar` and `DateTime` types can be compared in SQL without any explicit casts; C# requires explicit conversion.
+
+- `Decimal` is implicitly converted to `DateTime` in SQL. C# does not allow for an implicit conversion.
+
+Likewise, type precedence in Transact-SQL differs from type precedence in C# because the underlying set of types is different. In fact, there is no clear subset/superset relationship between the precedence lists. For example, comparing an `nvarchar` with a `varchar` causes the implicit conversion of the `varchar` expression to `nvarchar`. The CLR provides no equivalent promotion.
+
+In simple cases, these differences cause CLR expressions with casts to be redundant for a corresponding SQL expression. More importantly, the intermediate results of a SQL expression might be implicitly promoted to a type that has no accurate counterpart in C#, and vice versa. Overall, the testing, debugging, and validation of such expressions adds significant burden on the user.
+
+### Collation
+
+Transact-SQL supports explicit collations as annotations to character string types. These collations determine the validity of certain comparisons. For example, comparing two columns with different explicit collations is an error. The use of much simplified CTS string type does not cause such errors. Consider the following example:
+
+```sql
+create table T2 (
+ Col1 nvarchar(10),
+ Col2 nvarchar(10) collate Latin_general_ci_as
+)
+```
+
+[!code-csharp[DLinqMismatch#4](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#4)]
+[!code-vb[DLinqMismatch#4](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#4)]
+
+```sql
+Select …
+From …
+Where Col1 = Col2
+-- Error, collation conflict.
+```
+
+In effect, the collation subclause creates a *restricted type* that is not substitutable.
+
+Similarly, the sort order can be significantly different across the type systems. This difference affects the sorting of results. is sorted on all 16 bytes by lexicographic order (`IComparable()`), whereas T-SQL compares GUIDs in the following order: node(10-15), clock-seq(8-9), time-high(6-7), time-mid(4-5), time-low(0-3). This ordering was done in SQL 7.0 when NT-generated GUIDs had such an octet order. The approach ensured that GUIDs generated at the same node cluster came together in sequential order according to timestamp. The approach was also useful for building indexes (inserts become appends instead of random IOs). The order was scrambled later in Windows because of privacy concerns, but SQL must maintain compatibility. A workaround is to use instead of .
+
+### Operator and Function Differences
+
+Operators and functions that are essentially comparable have subtly different semantics. For example:
+
+- C# specifies short circuit semantics based on lexical order of operands for logical operators `&&` and `||`. SQL on the other hand is targeted for set-based queries and therefore provides more freedom for the optimizer to decide the order of execution. Some of the implications include the following:
+
+ - Semantically equivalent translation would require "`CASE` … `WHEN` … `THEN`" construct in SQL to avoid reordering of operand execution.
+
+ - A loose translation to `AND`/`OR` operators could cause unexpected errors if the C# expression relies on evaluation the second operand being based on the result of the evaluation of the first operand.
+
+- `Round()` function has different semantics in [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] and in T-SQL.
+
+- Starting index for strings is 0 in the CLR but 1 in SQL. Therefore, any function that has index needs index translation.
+
+- The CLR supports modulus (‘%’) operator for floating point numbers but SQL does not.
+
+- The `Like` operator effectively acquires automatic overloads based on implicit conversions. Although the `Like` operator is defined to operate on character string types, implicit conversion from numeric types or `DateTime` types allows for those non-string types to be used with `Like` just as well. In CTS, comparable implicit conversions do not exist. Therefore, additional overloads are needed.
+
> [!NOTE]
- > This `Like` operator behavior applies to C# only; the Visual Basic `Like` keyword is unchanged.
-
-- Overflow is always checked in SQL but it has to be explicitly specified in C# (not in Visual Basic) to avoid wraparound. Given integer columns C1, C2 and C3, if C1+C2 is stored in C3 (Update T Set C3 = C1 + C2).
-
- ```
- create table T3 (
- Col1 integer,
- Col2 integer
- )
- insert into T3 (col1, col2) values (2147483647, 5)
- -- Valid values: max integer value and 5.
- select * from T3 where col1 + col2 < 0
- -- Produces arithmetic overflow error.
- ```
-
- [!code-csharp[DLinqMismatch#5](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#5)]
- [!code-vb[DLinqMismatch#5](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#5)]
-
-- SQL performs symmetric arithmetic rounding while [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] uses banker’s rounding. See Knowledgebase article 196652 for additional details.
-
-- By default, for common locales, character-string comparisons are case-insensitive in SQL. In Visual Basic and in C#, they are case-sensitive. For example, `s == "Food"` (`s = "Food"` in Visual Basic) and `s == "Food"` can yield different results if `s` is `food`.
-
- ```
- -- Assume default US-English locale (case insensitive).
- create table T4 (
- Col1 nvarchar (256)
- )
- insert into T4 values (‘Food’)
- insert into T4 values (‘FOOD’)
- select * from T4 where Col1 = ‘food’
- -- Both the rows are returned because of case-insensitive matching.
- ```
-
- [!code-csharp[DLinqMismatch#6](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#6)]
- [!code-vb[DLinqMismatch#6](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#6)]
-
-- Operators/ functions applied to fixed length character type arguments in SQL have significantly different semantics than the same operators/functions applied to the CLR . This could also be viewed as an extension of the missing counterpart problem discussed in the section about types.
-
- ```
- create table T4 (
- Col1 nchar(4)
- )
- Insert into T5(Col1) values ('21');
- Insert into T5(Col1) values ('1021');
- Select * from T5 where Col1 like '%1'
- -- Only the second row with Col1 = '1021' is returned.
- -- Not the first row!
- ```
-
+ > This `Like` operator behavior applies to C# only; the Visual Basic `Like` keyword is unchanged.
+
+- Overflow is always checked in SQL but it has to be explicitly specified in C# (not in Visual Basic) to avoid wraparound. Given integer columns C1, C2 and C3, if C1+C2 is stored in C3 (Update T Set C3 = C1 + C2).
+
+ ```sql
+ create table T3 (
+ Col1 integer,
+ Col2 integer
+ )
+ insert into T3 (col1, col2) values (2147483647, 5)
+ -- Valid values: max integer value and 5.
+ select * from T3 where col1 + col2 < 0
+ -- Produces arithmetic overflow error.
+ ```
+
+[!code-csharp[DLinqMismatch#5](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#5)]
+[!code-vb[DLinqMismatch#5](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#5)]
+
+- SQL performs symmetric arithmetic rounding while [!INCLUDE[dnprdnshort](../../../../../../includes/dnprdnshort-md.md)] uses banker’s rounding. See Knowledgebase article 196652 for additional details.
+
+- By default, for common locales, character-string comparisons are case-insensitive in SQL. In Visual Basic and in C#, they are case-sensitive. For example, `s == "Food"` (`s = "Food"` in Visual Basic) and `s == "Food"` can yield different results if `s` is `food`.
+
+ ```sql
+ -- Assume default US-English locale (case insensitive).
+ create table T4 (
+ Col1 nvarchar (256)
+ )
+ insert into T4 values (‘Food’)
+ insert into T4 values (‘FOOD’)
+ select * from T4 where Col1 = ‘food’
+ -- Both the rows are returned because of case-insensitive matching.
+ ```
+
+[!code-csharp[DLinqMismatch#6](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#6)]
+[!code-vb[DLinqMismatch#6](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#6)]
+
+- Operators/ functions applied to fixed length character type arguments in SQL have significantly different semantics than the same operators/functions applied to the CLR . This could also be viewed as an extension of the missing counterpart problem discussed in the section about types.
+
+ ```sql
+ create table T4 (
+ Col1 nchar(4)
+ )
+ Insert into T5(Col1) values ('21');
+ Insert into T5(Col1) values ('1021');
+ Select * from T5 where Col1 like '%1'
+ -- Only the second row with Col1 = '1021' is returned.
+ -- Not the first row!
+ ```
+
[!code-csharp[DLinqMismatch#7](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#7)]
- [!code-vb[DLinqMismatch#7](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#7)]
-
- A similar problem occurs with string concatenation.
-
- ```
- create table T6 (
- Col1 nchar(4)
- Col2 nchar(4)
- )
- Insert into T6 values ('a', 'b');
- Select Col1+Col2 from T6
- -- Returns concatenation of padded strings "a b " and not "ab".
- ```
-
- In summary, a convoluted translation might be required for CLR expressions and additional operators/functions may be necessary to expose SQL functionality.
-
-### Type Casting
- In C# and in SQL, users can override the default semantics of expressions by using explicit type casts (`Cast` and `Convert`). However, exposing this capability across the type system boundary poses a dilemma. A SQL cast that provides the desired semantics cannot be easily translated to a corresponding C# cast. On the other hand, a C# cast cannot be directly translated into an equivalent SQL cast because of type mismatches, missing counterparts, and different type precedence hierarchies. There is a trade-off between exposing the type system mismatch and losing significant power of expression.
-
- In other cases, type casting might not be needed in either domain for validation of an expression but might be required to make sure that a non-default mapping is correctly applied to the expression.
-
-```
--- Example from "Non-default Mapping" section extended
-create table T5 (
- Col1 nvarchar(10),
- Col2 nvarchar(10)
-)
-Insert into T5(col1, col2) values (‘3’, ‘2’);
-```
-
- [!code-csharp[DLinqMismatch#8](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#8)]
- [!code-vb[DLinqMismatch#8](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#8)]
-
-```
-Select *
-From T5
-Where Col1 + Col2 > 4
--- "Col1 + Col2" expr evaluates to '32'
-```
-
-## Performance Issues
- Accounting for some SQL Server-CLR type differences may result in a decrease in performance when crossing between the CLR and SQL Server type systems. Examples of scenarios impacting performance include the following:
-
-- Forced order of evaluation for logical and/or operators
-
-- Generating SQL to enforce order of predicate evaluation restricts the SQL optimizer’s ability.
-
-- Type conversions, whether introduced by a CLR compiler or by an Object-Relational query implementation, may curtail index usage.
-
- For example,
-
- ```
- -- Table DDL
- create table T5 (
- Col1 varchar(100)
- )
- ```
-
+ [!code-vb[DLinqMismatch#7](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#7)]
+
+ A similar problem occurs with string concatenation.
+
+ ```sql
+ create table T6 (
+ Col1 nchar(4)
+ Col2 nchar(4)
+ )
+ Insert into T6 values ('a', 'b');
+ Select Col1+Col2 from T6
+ -- Returns concatenation of padded strings "a b " and not "ab".
+ ```
+
+In summary, a convoluted translation might be required for CLR expressions and additional operators/functions may be necessary to expose SQL functionality.
+
+### Type Casting
+
+In C# and in SQL, users can override the default semantics of expressions by using explicit type casts (`Cast` and `Convert`). However, exposing this capability across the type system boundary poses a dilemma. A SQL cast that provides the desired semantics cannot be easily translated to a corresponding C# cast. On the other hand, a C# cast cannot be directly translated into an equivalent SQL cast because of type mismatches, missing counterparts, and different type precedence hierarchies. There is a trade-off between exposing the type system mismatch and losing significant power of expression.
+
+In other cases, type casting might not be needed in either domain for validation of an expression but might be required to make sure that a non-default mapping is correctly applied to the expression.
+
+```sql
+-- Example from "Non-default Mapping" section extended
+create table T5 (
+ Col1 nvarchar(10),
+ Col2 nvarchar(10)
+)
+Insert into T5(col1, col2) values (‘3’, ‘2’);
+```
+
+[!code-csharp[DLinqMismatch#8](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#8)]
+[!code-vb[DLinqMismatch#8](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#8)]
+
+```sql
+Select *
+From T5
+Where Col1 + Col2 > 4
+-- "Col1 + Col2" expr evaluates to '32'
+```
+
+## Performance Issues
+
+Accounting for some SQL Server-CLR type differences may result in a decrease in performance when crossing between the CLR and SQL Server type systems. Examples of scenarios impacting performance include the following:
+
+- Forced order of evaluation for logical and/or operators
+
+- Generating SQL to enforce order of predicate evaluation restricts the SQL optimizer’s ability.
+
+- Type conversions, whether introduced by a CLR compiler or by an Object-Relational query implementation, may curtail index usage.
+
+ For example,
+
+ ```sql
+ -- Table DDL
+ create table T5 (
+ Col1 varchar(100)
+ )
+ ```
+
[!code-csharp[DLinqMismatch#9](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqMismatch/cs/Program.cs#9)]
- [!code-vb[DLinqMismatch#9](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#9)]
-
- Consider the translation of expression `(s = SOME_STRING_CONSTANT)`.
-
- ```
- -- Corresponding part of SQL where clause
- Where …
- Col1 = SOME_STRING_CONSTANT
- -- This expression is of the form = .
- -- Hence SQL introduces a conversion from varchar to nvarchar,
- -- resulting in
- Where …
- Convert(nvarchar(100), Col1) = SOME_STRING_CONSTANT
- -- Cannot use the index for column Col1 for some implementations.
- ```
-
- In addition to semantic differences, it is important to consider impacts to performance when crossing between the SQL Server and CLR type systems. For large data sets, such performance issues can determine whether an application is deployable.
-
+ [!code-vb[DLinqMismatch#9](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqMismatch/vb/Module1.vb#9)]
+
+ Consider the translation of expression `(s = SOME_STRING_CONSTANT)`.
+
+ ```sql
+ -- Corresponding part of SQL where clause
+ Where …
+ Col1 = SOME_STRING_CONSTANT
+ -- This expression is of the form = .
+ -- Hence SQL introduces a conversion from varchar to nvarchar,
+ -- resulting in
+ Where …
+ Convert(nvarchar(100), Col1) = SOME_STRING_CONSTANT
+ -- Cannot use the index for column Col1 for some implementations.
+ ```
+
+In addition to semantic differences, it is important to consider impacts to performance when crossing between the SQL Server and CLR type systems. For large data sets, such performance issues can determine whether an application is deployable.
+
## See also
- [Background Information](../../../../../../docs/framework/data/adonet/sql/linq/background-information.md)
diff --git a/docs/framework/data/adonet/sql/linq/standard-query-operator-translation.md b/docs/framework/data/adonet/sql/linq/standard-query-operator-translation.md
index 88a3b88576641..b08780d2064a6 100644
--- a/docs/framework/data/adonet/sql/linq/standard-query-operator-translation.md
+++ b/docs/framework/data/adonet/sql/linq/standard-query-operator-translation.md
@@ -1,224 +1,245 @@
---
title: "Standard Query Operator Translation"
ms.date: "03/30/2017"
-dev_langs:
+dev_langs:
- "csharp"
- "vb"
ms.assetid: a60c30fa-1e68-45fe-b984-f6abb9ede40e
---
# Standard Query Operator Translation
-[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translates Standard Query Operators to SQL commands. The query processor of the database determines the execution semantics of SQL translation.
-
- Standard Query Operators are defined against *sequences*. A sequence is *ordered* and relies on reference identity for each element of the sequence. For more information, see [Standard Query Operators Overview (C#)](../../../../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) or [Standard Query Operators Overview (Visual Basic)](../../../../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md).
-
- SQL deals primarily with *unordered sets of values*. Ordering is typically an explicitly stated, post-processing operation that is applied to the final result of a query rather than to intermediate results. Identity is defined by values. For this reason, SQL queries are understood to deal with multisets (*bags*) instead of *sets*.
-
- The following paragraphs describe the differences between the Standard Query Operators and their SQL translation for the SQL Server provider for [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].
-
-## Operator Support
-
-### Concat
- The method is defined for ordered multisets where the order of the receiver and the order of the argument are the same. works as `UNION ALL` over the multisets followed by the common order.
-
- The final step is ordering in SQL before results are produced. does not preserve the order of its arguments. To ensure appropriate ordering, you must explicitly order the results of .
-
-### Intersect, Except, Union
- The and methods are well defined only on sets. The semantics for multisets is undefined.
-
- The method is defined for multisets as the unordered concatenation of the multisets (effectively the result of the UNION ALL clause in SQL).
-
-### Take, Skip
- and methods are well defined only against *ordered sets*. The semantics for unordered sets or multisets are undefined.
-
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translates Standard Query Operators to SQL commands. The query processor of the database determines the execution semantics of SQL translation.
+
+Standard Query Operators are defined against *sequences*. A sequence is *ordered* and relies on reference identity for each element of the sequence. For more information, see [Standard Query Operators Overview (C#)](../../../../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) or [Standard Query Operators Overview (Visual Basic)](../../../../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md).
+
+SQL deals primarily with *unordered sets of values*. Ordering is typically an explicitly stated, post-processing operation that is applied to the final result of a query rather than to intermediate results. Identity is defined by values. For this reason, SQL queries are understood to deal with multisets (*bags*) instead of *sets*.
+
+The following paragraphs describe the differences between the Standard Query Operators and their SQL translation for the SQL Server provider for [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].
+
+## Operator Support
+
+### Concat
+
+The method is defined for ordered multisets where the order of the receiver and the order of the argument are the same. works as `UNION ALL` over the multisets followed by the common order.
+
+The final step is ordering in SQL before results are produced. does not preserve the order of its arguments. To ensure appropriate ordering, you must explicitly order the results of .
+
+### Intersect, Except, Union
+
+The and methods are well defined only on sets. The semantics for multisets is undefined.
+
+The method is defined for multisets as the unordered concatenation of the multisets (effectively the result of the UNION ALL clause in SQL).
+
+### Take, Skip
+
+ and methods are well defined only against *ordered sets*. The semantics for unordered sets or multisets are undefined.
+
> [!NOTE]
-> and have certain limitations when they are used in queries against SQL Server 2000. For more information, see the "Skip and Take Exceptions in SQL Server 2000" entry in [Troubleshooting](../../../../../../docs/framework/data/adonet/sql/linq/troubleshooting.md).
-
- Because of limitations on ordering in SQL, [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] tries to move the ordering of the argument of these methods to the result of the method. For example, consider the following [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] query:
-
- [!code-csharp[DLinqSQOTranslation#1](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#1)]
- [!code-vb[DLinqSQOTranslation#1](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#1)]
-
- The generated SQL for this code moves the ordering to the end, as follows:
-
-```
-SELECT TOP 1 [t0].[CustomerID], [t0].[CompanyName],
-FROM [Customers] AS [t0]
-WHERE (NOT (EXISTS(
- SELECT NULL AS [EMPTY]
- FROM (
- SELECT TOP 1 [t1].[CustomerID]
- FROM [Customers] AS [t1]
- WHERE [t1].[City] = @p0
- ORDER BY [t1].[CustomerID]
- ) AS [t2]
- WHERE [t0].[CustomerID] = [t2].[CustomerID]
- ))) AND ([t0].[City] = @p1)
-ORDER BY [t0].[CustomerID]
-```
-
- It becomes obvious that all the specified ordering must be consistent when and are chained together. Otherwise, the results are undefined.
-
- Both and are well-defined for non-negative, constant integral arguments based on the Standard Query Operator specification.
-
-### Operators with No Translation
- The following methods are not translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)]. The most common reason is the difference between unordered multisets and sequences.
-
-|Operators|Rationale|
-|---------------|---------------|
-|, |SQL queries operate on multisets, not on sequences. `ORDER BY` must be the last clause applied to the results. For this reason, there is no general-purpose translation for these two methods.|
-||Translation of this method is possible for an ordered set but is not currently translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].|
-|, |Translation of these methods is possible for an ordered set but is not currently translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].|
-|, |SQL queries operate on multisets, not on indexable sequences.|
-| (overload with default arg)|In general, a default value cannot be specified for an arbitrary tuple. Null values for tuples are possible in some cases through outer joins.|
-
-## Expression Translation
-
-### Null semantics
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not impose null comparison semantics on SQL. Comparison operators are syntactically translated to their SQL equivalents. For this reason, the semantics reflect SQL semantics that are defined by server or connection settings. For example, two null values are considered unequal under default SQL Server settings, but you can change the settings to change the semantics. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not consider server settings when it translates queries.
-
- A comparison with the literal null is translated to the appropriate SQL version (`is null` or `is not null`).
-
- The value of `null` in collation is defined by SQL Server. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not change the collation.
-
-### Aggregates
- The Standard Query Operator aggregate method evaluates to zero for an empty sequence or for a sequence that contains only nulls. In [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)], the semantics of SQL are left unchanged, and evaluates to `null` instead of zero for an empty sequence or for a sequence that contains only nulls.
-
- SQL limitations on intermediate results apply to aggregates in [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)]. The of 32-bit integer quantities is not computed by using 64-bit results. Overflow might occur for a [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translation of , even if the Standard Query Operator implementation does not cause an overflow for the corresponding in-memory sequence.
-
- Likewise, the [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translation of of integer values is computed as an `integer`, not as a `double`.
-
-### Entity Arguments
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] enables entity types to be used in the and methods. In the translation of these operators, the use of an argument of a type is considered to be the equivalent to specifying all members of that type. For example, the following code is equivalent:
-
- [!code-csharp[DLinqSQOTranslation#2](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#2)]
- [!code-vb[DLinqSQOTranslation#2](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#2)]
-
-### Equatable / Comparable Arguments
- Equality of arguments is required in the implementation of the following methods:
-
-
-
-
-
-
-
-
-
-
-
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] supports equality and comparison for *flat* arguments, but not for arguments that are or contain sequences. A flat argument is a type that can be mapped to a SQL row. A projection of one or more entity types that can be statically determined not to contain a sequence is considered a flat argument.
-
- Following are examples of flat arguments:
-
- [!code-csharp[DLinqSQOTranslation#3](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#3)]
- [!code-vb[DLinqSQOTranslation#3](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#3)]
-
- The following are examples of non-flat (hierarchical) arguments.
-
- [!code-csharp[DLinqSQOTranslation#4](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#4)]
- [!code-vb[DLinqSQOTranslation#4](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#4)]
-
-### Visual Basic Function Translation
- The following helper functions that are used by the Visual Basic compiler are translated to corresponding SQL operators and functions:
-
- `CompareString`
-
- `DateTime.Compare`
-
- `Decimal.Compare`
-
- `IIf (in Microsoft.VisualBasic.Interaction)`
-
- Conversion methods:
-
-|||||
-|-|-|-|-|
-|ToBoolean|ToSByte|ToByte|ToChar|
-|ToCharArrayRankOne|ToDate|ToDecimal|ToDouble|
-|ToInteger|ToUInteger|ToLong|ToULong|
-|ToShort|ToUShort|ToSingle|ToString|
-
-## Inheritance Support
-
-### Inheritance Mapping Restrictions
- For more information, see [How to: Map Inheritance Hierarchies](../../../../../../docs/framework/data/adonet/sql/linq/how-to-map-inheritance-hierarchies.md).
-
-### Inheritance in Queries
- C# casts are supported only in projection. Casts that are used elsewhere are not translated and are ignored. Aside from SQL function names, SQL really only performs the equivalent of the common language runtime (CLR) . That is, SQL can change the value of one type to another. There is no equivalent of CLR cast because there is no concept of reinterpreting the same bits as those of another type. That is why a C# cast works only locally. It is not remoted.
-
- The operators, `is` and `as`, and the `GetType` method are not restricted to the `Select` operator. They can be used in other query operators also.
-
-## SQL Server 2008 Support
- Starting with the .NET Framework 3.5 SP1, LINQ to SQL supports mapping to new date and time types introduced with SQL Server 2008. But, there are some limitations to the LINQ to SQL query operators that you can use when operating against values mapped to these new types.
-
-### Unsupported Query Operators
- The following query operators are not supported on values mapped to the new SQL Server date and time types: `DATETIME2`, `DATE`, `TIME`, and `DATETIMEOFFSET`.
-
-- `Aggregate`
-
-- `Average`
-
-- `LastOrDefault`
-
-- `OfType`
-
-- `Sum`
-
- For more information about mapping to these SQL Server date and time types, see [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md).
-
-## SQL Server 2005 Support
- [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not support the following SQL Server 2005 features:
-
-- Stored procedures written for SQL CLR.
-
-- User-defined type.
-
-- XML query features.
-
-## SQL Server 2000 Support
- The following [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] limitations (compared to [!INCLUDE[sqprsqext](../../../../../../includes/sqprsqext-md.md)]) affect [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] support.
-
-### Cross Apply and Outer Apply Operators
- These operators are not available in [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)]. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] tries a series of rewrites to replace them with appropriate joins.
-
- `Cross Apply` and `Outer Apply` are generated for relationship navigations. The set of queries for which such rewrites are possible is not well defined. For this reason, the minimal set of queries that is supported for [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] is the set that does not involve relationship navigation.
-
-### text / ntext
- Data types `text` / `ntext` cannot be used in certain query operations against `varchar(max)` / `nvarchar(max)`, which are supported by [!INCLUDE[sqprsqext](../../../../../../includes/sqprsqext-md.md)].
-
- No resolution is available for this limitation. Specifically, you cannot use `Distinct()` on any result that contains members that are mapped to `text` or `ntext` columns.
-
-### Behavior Triggered by Nested Queries
- [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] (through SP4) binder has some idiosyncrasies that are triggered by nested queries. The set of SQL queries that triggers these idiosyncrasies is not well defined. For this reason, you cannot define the set of [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] queries that might cause SQL Server exceptions.
-
-### Skip and Take Operators
- and have certain limitations when they are used in queries against [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)]. For more information, see the "Skip and Take Exceptions in SQL Server 2000" entry in [Troubleshooting](../../../../../../docs/framework/data/adonet/sql/linq/troubleshooting.md).
-
-## Object Materialization
- Materialization creates CLR objects from rows that are returned by one or more SQL queries.
-
-- The following calls are *executed locally* as a part of materialization:
-
- - Constructors
-
- - `ToString` methods in projections
-
- - Type casts in projections
-
-- Methods that follow the method are *executed locally*. This method does not cause immediate execution.
-
-- You can use a `struct` as the return type of a query result or as a member of the result type. Entities are required to be classes. Anonymous types are materialized as class instances, but named structs (non-entities) can be used in projection.
-
-- A member of the return type of a query result can be of type . It is materialized as a local collection.
-
-- The following methods cause the *immediate materialization* of the sequence that the methods are applied to:
-
- -
-
- -
-
- -
-
+> and have certain limitations when they are used in queries against SQL Server 2000. For more information, see the "Skip and Take Exceptions in SQL Server 2000" entry in [Troubleshooting](../../../../../../docs/framework/data/adonet/sql/linq/troubleshooting.md).
+
+Because of limitations on ordering in SQL, [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] tries to move the ordering of the argument of these methods to the result of the method. For example, consider the following [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] query:
+
+[!code-csharp[DLinqSQOTranslation#1](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#1)]
+[!code-vb[DLinqSQOTranslation#1](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#1)]
+
+The generated SQL for this code moves the ordering to the end, as follows:
+
+```sql
+SELECT TOP 1 [t0].[CustomerID], [t0].[CompanyName],
+FROM [Customers] AS [t0]
+WHERE (NOT (EXISTS(
+ SELECT NULL AS [EMPTY]
+ FROM (
+ SELECT TOP 1 [t1].[CustomerID]
+ FROM [Customers] AS [t1]
+ WHERE [t1].[City] = @p0
+ ORDER BY [t1].[CustomerID]
+ ) AS [t2]
+ WHERE [t0].[CustomerID] = [t2].[CustomerID]
+ ))) AND ([t0].[City] = @p1)
+ORDER BY [t0].[CustomerID]
+```
+
+It becomes obvious that all the specified ordering must be consistent when and are chained together. Otherwise, the results are undefined.
+
+Both and are well-defined for non-negative, constant integral arguments based on the Standard Query Operator specification.
+
+### Operators with No Translation
+
+The following methods are not translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)]. The most common reason is the difference between unordered multisets and sequences.
+
+|Operators|Rationale|
+|---------------|---------------|
+|, |SQL queries operate on multisets, not on sequences. `ORDER BY` must be the last clause applied to the results. For this reason, there is no general-purpose translation for these two methods.|
+||Translation of this method is possible for an ordered set but is not currently translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].|
+|, |Translation of these methods is possible for an ordered set but is not currently translated by [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)].|
+|, |SQL queries operate on multisets, not on indexable sequences.|
+| (overload with default arg)|In general, a default value cannot be specified for an arbitrary tuple. Null values for tuples are possible in some cases through outer joins.|
+
+## Expression Translation
+
+### Null semantics
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not impose null comparison semantics on SQL. Comparison operators are syntactically translated to their SQL equivalents. For this reason, the semantics reflect SQL semantics that are defined by server or connection settings. For example, two null values are considered unequal under default SQL Server settings, but you can change the settings to change the semantics. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not consider server settings when it translates queries.
+
+A comparison with the literal null is translated to the appropriate SQL version (`is null` or `is not null`).
+
+The value of `null` in collation is defined by SQL Server. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not change the collation.
+
+### Aggregates
+
+The Standard Query Operator aggregate method evaluates to zero for an empty sequence or for a sequence that contains only nulls. In [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)], the semantics of SQL are left unchanged, and evaluates to `null` instead of zero for an empty sequence or for a sequence that contains only nulls.
+
+SQL limitations on intermediate results apply to aggregates in [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)]. The of 32-bit integer quantities is not computed by using 64-bit results. Overflow might occur for a [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translation of , even if the Standard Query Operator implementation does not cause an overflow for the corresponding in-memory sequence.
+
+Likewise, the [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] translation of of integer values is computed as an `integer`, not as a `double`.
+
+### Entity Arguments
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] enables entity types to be used in the and methods. In the translation of these operators, the use of an argument of a type is considered to be the equivalent to specifying all members of that type. For example, the following code is equivalent:
+
+[!code-csharp[DLinqSQOTranslation#2](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#2)]
+[!code-vb[DLinqSQOTranslation#2](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#2)]
+
+### Equatable / Comparable Arguments
+
+Equality of arguments is required in the implementation of the following methods:
+
+-
+
+-
+
+-
+
+-
+
+-
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] supports equality and comparison for *flat* arguments, but not for arguments that are or contain sequences. A flat argument is a type that can be mapped to a SQL row. A projection of one or more entity types that can be statically determined not to contain a sequence is considered a flat argument.
+
+Following are examples of flat arguments:
+
+[!code-csharp[DLinqSQOTranslation#3](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#3)]
+[!code-vb[DLinqSQOTranslation#3](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#3)]
+
+The following are examples of non-flat (hierarchical) arguments.
+
+[!code-csharp[DLinqSQOTranslation#4](../../../../../../samples/snippets/csharp/VS_Snippets_Data/DLinqSQOTranslation/cs/Program.cs#4)]
+[!code-vb[DLinqSQOTranslation#4](../../../../../../samples/snippets/visualbasic/VS_Snippets_Data/DLinqSQOTranslation/vb/Module1.vb#4)]
+
+### Visual Basic Function Translation
+
+The following helper functions that are used by the Visual Basic compiler are translated to corresponding SQL operators and functions:
+
+- `CompareString`
+
+- `DateTime.Compare`
+
+- `Decimal.Compare`
+
+- `IIf (in Microsoft.VisualBasic.Interaction)`
+
+Conversion methods:
+
+|||||
+|-|-|-|-|
+|ToBoolean|ToSByte|ToByte|ToChar|
+|ToCharArrayRankOne|ToDate|ToDecimal|ToDouble|
+|ToInteger|ToUInteger|ToLong|ToULong|
+|ToShort|ToUShort|ToSingle|ToString|
+
+## Inheritance Support
+
+### Inheritance Mapping Restrictions
+
+For more information, see [How to: Map Inheritance Hierarchies](../../../../../../docs/framework/data/adonet/sql/linq/how-to-map-inheritance-hierarchies.md).
+
+### Inheritance in Queries
+
+C# casts are supported only in projection. Casts that are used elsewhere are not translated and are ignored. Aside from SQL function names, SQL really only performs the equivalent of the common language runtime (CLR) . That is, SQL can change the value of one type to another. There is no equivalent of CLR cast because there is no concept of reinterpreting the same bits as those of another type. That is why a C# cast works only locally. It is not remoted.
+
+The operators, `is` and `as`, and the `GetType` method are not restricted to the `Select` operator. They can be used in other query operators also.
+
+## SQL Server 2008 Support
+
+Starting with the .NET Framework 3.5 SP1, LINQ to SQL supports mapping to new date and time types introduced with SQL Server 2008. But, there are some limitations to the LINQ to SQL query operators that you can use when operating against values mapped to these new types.
+
+### Unsupported Query Operators
+
+The following query operators are not supported on values mapped to the new SQL Server date and time types: `DATETIME2`, `DATE`, `TIME`, and `DATETIMEOFFSET`.
+
+- `Aggregate`
+
+- `Average`
+
+- `LastOrDefault`
+
+- `OfType`
+
+- `Sum`
+
+For more information about mapping to these SQL Server date and time types, see [SQL-CLR Type Mapping](../../../../../../docs/framework/data/adonet/sql/linq/sql-clr-type-mapping.md).
+
+## SQL Server 2005 Support
+
+[!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] does not support the following SQL Server 2005 features:
+
+- Stored procedures written for SQL CLR.
+
+- User-defined type.
+
+- XML query features.
+
+## SQL Server 2000 Support
+
+The following [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] limitations (compared to [!INCLUDE[sqprsqext](../../../../../../includes/sqprsqext-md.md)]) affect [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] support.
+
+### Cross Apply and Outer Apply Operators
+
+These operators are not available in [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)]. [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] tries a series of rewrites to replace them with appropriate joins.
+
+`Cross Apply` and `Outer Apply` are generated for relationship navigations. The set of queries for which such rewrites are possible is not well defined. For this reason, the minimal set of queries that is supported for [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] is the set that does not involve relationship navigation.
+
+### text / ntext
+
+Data types `text` / `ntext` cannot be used in certain query operations against `varchar(max)` / `nvarchar(max)`, which are supported by [!INCLUDE[sqprsqext](../../../../../../includes/sqprsqext-md.md)].
+
+No resolution is available for this limitation. Specifically, you cannot use `Distinct()` on any result that contains members that are mapped to `text` or `ntext` columns.
+
+### Behavior Triggered by Nested Queries
+
+[!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)] (through SP4) binder has some idiosyncrasies that are triggered by nested queries. The set of SQL queries that triggers these idiosyncrasies is not well defined. For this reason, you cannot define the set of [!INCLUDE[vbtecdlinq](../../../../../../includes/vbtecdlinq-md.md)] queries that might cause SQL Server exceptions.
+
+### Skip and Take Operators
+
+ and have certain limitations when they are used in queries against [!INCLUDE[ss2k](../../../../../../includes/ss2k-md.md)]. For more information, see the "Skip and Take Exceptions in SQL Server 2000" entry in [Troubleshooting](../../../../../../docs/framework/data/adonet/sql/linq/troubleshooting.md).
+
+## Object Materialization
+
+Materialization creates CLR objects from rows that are returned by one or more SQL queries.
+
+- The following calls are *executed locally* as a part of materialization:
+
+ - Constructors
+
+ - `ToString` methods in projections
+
+ - Type casts in projections
+
+- Methods that follow the method are *executed locally*. This method does not cause immediate execution.
+
+- You can use a `struct` as the return type of a query result or as a member of the result type. Entities are required to be classes. Anonymous types are materialized as class instances, but named structs (non-entities) can be used in projection.
+
+- A member of the return type of a query result can be of type . It is materialized as a local collection.
+
+- The following methods cause the *immediate materialization* of the sequence that the methods are applied to:
+
+ -
+
+ -
+
+ -
+
## See also
- [Reference](../../../../../../docs/framework/data/adonet/sql/linq/reference.md)
diff --git a/docs/framework/data/adonet/whats-new.md b/docs/framework/data/adonet/whats-new.md
index 6458aa41cba0b..32b06b6894b35 100644
--- a/docs/framework/data/adonet/whats-new.md
+++ b/docs/framework/data/adonet/whats-new.md
@@ -4,46 +4,49 @@ ms.date: "03/30/2017"
ms.assetid: 3bb65d38-cce2-46f5-b979-e5c505e95e10
---
# What's New in ADO.NET
-The following features are new in [!INCLUDE[vstecado](../../../../includes/vstecado-md.md)] in the [!INCLUDE[net_v45](../../../../includes/net-v45-md.md)].
-
-## SqlClient Data Provider
- The following features are new in the [!INCLUDE[dnprdnshort](../../../../includes/dnprdnshort-md.md)] Data Provider for SQL Server in [!INCLUDE[net_v45](../../../../includes/net-v45-md.md)]:
-
-- The ConnectRetryCount and ConnectRetryInterval connection string keywords () let you control the idle connection resiliency feature.
-
-- Streaming support from SQL Server to an application supports scenarios where data on the server is unstructured. See [SqlClient Streaming Support](../../../../docs/framework/data/adonet/sqlclient-streaming-support.md) for more information.
-
-- Support has been added for asynchronous programming. See [Asynchronous Programming](../../../../docs/framework/data/adonet/asynchronous-programming.md) for more information.
-
-- Connection failures will now be logged in the extended events log. For more information, see [Data Tracing in ADO.NET](../../../../docs/framework/data/adonet/data-tracing.md).
-
-- SqlClient now has support for SQL Server's high availability, disaster recovery feature, AlwaysOn. For more information, see [SqlClient Support for High Availability, Disaster Recovery](../../../../docs/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery.md).
-
-- A password can be passed as a when using SQL Server Authentication. See for more information.
-
-- When `TrustServerCertificate` is false and `Encrypt` is true, the server name (or IP address) in a SQL Server SSL certificate must exactly match the server name (or IP address) specified in the connection string. Otherwise, the connection attempt will fail. For more information, see the description of the `Encrypt` connection option in .
-
- If this change causes an existing application to no longer connect, you can fix the application using one of the following:
-
- - Issue a certificate that specifies the short name in the Common Name (CN) or Subject Alternative Name (SAN) field. This solution will work for database mirroring.
-
- - Add an alias that maps the short name to the fully-qualified domain name.
-
- - Use the fully-qualified domain name in the connection string.
-
-- SqlClient supports Extended Protection. For more information about Extended Protection, see [Connecting to the Database Engine Using Extended Protection](https://go.microsoft.com/fwlink/?LinkId=219978).
-
-- SqlClient supports connections to LocalDB databases. For more information, see [SqlClient Support for LocalDB](../../../../docs/framework/data/adonet/sql/sqlclient-support-for-localdb.md).
-
-- `Type System Version=SQL Server 2012;` is new value to pass to the `Type System Version` connection property. The `Type System Version=Latest;` value is now obsolete and has been made equivalent to `Type System Version=SQL Server 2008;`. For more information, see .
-
-- SqlClient provides additional support for sparse columns, a feature that was added in SQL Server 2008. If your application already accesses data in a table that uses sparse columns, you should see an increase in performance. The IsColumnSet column of indicates if a column is a sparse column that is a member of a column set.