diff --git a/docs/core/about.md b/docs/core/about.md index 9eff33e93b137..0fc52bc2d475d 100644 --- a/docs/core/about.md +++ b/docs/core/about.md @@ -11,7 +11,7 @@ ms.date: 08/01/2018 - **Cross-platform:** Runs on Windows, macOS and Linux [operating systems](https://github.com/dotnet/core/blob/master/os-lifecycle-policy.md). - **Consistent across architectures:** Runs your code with the same behavior on multiple architectures, including x64, x86, and ARM. -- **Command-line tools:** Includes easy-to-use command-line tools that be used for local development and in continuous-integration scenarios. +- **Command-line tools:** Includes easy-to-use command-line tools that can be used for local development and in continuous-integration scenarios. - **Flexible deployment:** Can be included in your app or installed side-by-side user- or machine-wide. Can be used with [Docker containers](docker/index.md). - **Compatible:** .NET Core is compatible with .NET Framework, Xamarin and Mono, via [.NET Standard](../standard/net-standard.md). - **Open source:** The .NET Core platform is open source, using MIT and Apache 2 licenses. .NET Core is a [.NET Foundation](https://dotnetfoundation.org/) project. diff --git a/docs/core/tutorials/netcore-hosting.md b/docs/core/tutorials/netcore-hosting.md index e496ccc80ae9d..9b861bd0ed0a6 100644 --- a/docs/core/tutorials/netcore-hosting.md +++ b/docs/core/tutorials/netcore-hosting.md @@ -76,7 +76,6 @@ Common AppDomain properties include: * `APP_NI_PATHS` This list is very similar to APP_PATHS except that it's meant to be paths that will be probed for native images. * `NATIVE_DLL_SEARCH_DIRECTORIES` This property is a list of paths the loader should probe when looking for native DLLs called via p/invoke. * `PLATFORM_RESOURCE_ROOTS` This list includes paths to probe in for resource satellite assemblies (in culture-specific sub-directories). -* `AppDomainCompatSwitch` This string specifies which compatibility quirks should be used for assemblies without an explicit Target Framework Moniker (an assembly-level attribute indicating which Framework an assembly is meant to run against). Typically, this should be set to `"UseLatestBehaviorWhenTFMNotSpecified"` but some hosts may prefer to get older Silverlight or Windows Phone compatibility quirks, instead. In our [simple sample host](https://github.com/dotnet/samples/tree/master/core/hosting), these properties are set up as follows: diff --git a/docs/csharp/language-reference/compiler-messages/cs0116.md b/docs/csharp/language-reference/compiler-messages/cs0116.md index fd826f051af4f..4ecf0e2140e62 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0116.md +++ b/docs/csharp/language-reference/compiler-messages/cs0116.md @@ -9,9 +9,11 @@ ms.assetid: 4cb137b5-ec29-4c1a-adde-9f8424cb9496 --- # Compiler Error CS0116 -A namespace does not directly contain members such as fields or methods +A namespace cannot directly contain members such as fields or methods - Inside a [namespace](../../../csharp/language-reference/keywords/namespace.md), the compiler only accepts classes, structures, unions, enumerations, interfaces, and delegates. This error is often generated by developers from a C/C++ background who forget that in C#, methods and variables must be declared and defined within a struct or class. For more information, see [General Structure of a C# Program](../../../csharp/programming-guide/inside-a-program/general-structure-of-a-csharp-program.md). +A namespace can contain only other namespaces and type declarations. For more information, see the [namespace keyword](../keywords/namespace.md) article. + +This error is often generated by developers from a C/C++ background who forget that in C#, methods and variables must be declared and defined within a struct or class. ## Example @@ -40,7 +42,7 @@ namespace x } ``` -## See Also +## See also - [General Structure of a C# Program](../../../csharp/programming-guide/inside-a-program/general-structure-of-a-csharp-program.md) - [Classes and Structs](../../../csharp/programming-guide/classes-and-structs/index.md) diff --git a/docs/csharp/language-reference/keywords/from-clause.md b/docs/csharp/language-reference/keywords/from-clause.md index d7bf0652d29f3..bfc8f27853214 100644 --- a/docs/csharp/language-reference/keywords/from-clause.md +++ b/docs/csharp/language-reference/keywords/from-clause.md @@ -27,9 +27,9 @@ In the following example, `numbers` is the data source and `num` is the range va The compiler infers the type of the range variable when the data source implements . For example, if the source has a type of `IEnumerable`, then the range variable is inferred to be `Customer`. The only time that you must specify the type explicitly is when the source is a non-generic `IEnumerable` type such as . For more information, see [How to: Query an ArrayList with LINQ](../../programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md). -In the previous example `num` is inferred to be of type `int`. Because the range variable is strongly typed, you can call methods on it or use it in other operations. For example, instead of writing `select num`, you could write `select num.ToString()` to cause the query expression to return a sequence of strings instead of integers. Or you could write `select n + 10` to cause the expression to return the sequence 14, 11, 13, 12, 10. For more information, see [select clause](select-clause.md). +In the previous example `num` is inferred to be of type `int`. Because the range variable is strongly typed, you can call methods on it or use it in other operations. For example, instead of writing `select num`, you could write `select num.ToString()` to cause the query expression to return a sequence of strings instead of integers. Or you could write `select num + 10` to cause the expression to return the sequence 14, 11, 13, 12, 10. For more information, see [select clause](select-clause.md). -The range variable is like an iteration variable in a [foreach](foreach-in.md) statement except for one very important difference: a range variable never actually stores data from the source. It just a syntactic convenience that enables the query to describe what will occur when the query is executed. For more information, see [Introduction to LINQ Queries (C#)](../../programming-guide/concepts/linq/introduction-to-linq-queries.md). +The range variable is like an iteration variable in a [foreach](foreach-in.md) statement except for one very important difference: a range variable never actually stores data from the source. It's just a syntactic convenience that enables the query to describe what will occur when the query is executed. For more information, see [Introduction to LINQ Queries (C#)](../../programming-guide/concepts/linq/introduction-to-linq-queries.md). ## Compound from clauses diff --git a/docs/csharp/language-reference/keywords/ref.md b/docs/csharp/language-reference/keywords/ref.md index 635bf938832ff..a7d353e01f8b4 100644 --- a/docs/csharp/language-reference/keywords/ref.md +++ b/docs/csharp/language-reference/keywords/ref.md @@ -151,6 +151,7 @@ You can combine modifiers to declare a struct as `readonly ref`. A `readonly ref - [Write safe efficient code](../../write-safe-efficient-code.md) - [Ref returns and ref locals](../../programming-guide/classes-and-structs/ref-returns.md) - [Conditional ref expression](../operators/conditional-operator.md#conditional-ref-expression) +- [ref assignment operator](../operators/assignment-operator.md#ref-assignment-operator) - [Passing Parameters](../../programming-guide/classes-and-structs/passing-parameters.md) - [Method Parameters](method-parameters.md) - [C# Reference](../index.md) diff --git a/docs/csharp/language-reference/keywords/types.md b/docs/csharp/language-reference/keywords/types.md index 12e8c6c527bca..a710a7cb242a8 100644 --- a/docs/csharp/language-reference/keywords/types.md +++ b/docs/csharp/language-reference/keywords/types.md @@ -16,14 +16,12 @@ The C# typing system contains the following categories: - [Pointer types](../../programming-guide/unsafe-code-pointers/pointer-types.md) - Variables that are value types store data, and those that are reference types store references to the actual data. Reference types are also referred to as objects. Pointer types can be used only in [unsafe](unsafe.md) mode. + Variables that are value types store data, and those that are reference types store references to the actual data. Instances of reference types are also referred to as objects. Pointer types can be used only in [unsafe](unsafe.md) mode. It's possible to convert a value type to a reference type, and back again to a value type, by using [boxing and unboxing](../../../csharp/programming-guide/types/boxing-and-unboxing.md). With the exception of a boxed value type, you cannot convert a reference type to a value type. This section also introduces [void](void.md). - Value types are also nullable, which means they can store an additional non-value state. For more information, see [Nullable Types](../../../csharp/programming-guide/nullable-types/index.md). - ## See also - [C# Reference](../index.md) @@ -31,4 +29,4 @@ The C# typing system contains the following categories: - [C# Keywords](index.md) - [Reference Tables for Types](reference-tables-for-types.md) - [Casting and Type Conversions](../../programming-guide/types/casting-and-type-conversions.md) -- [Types](../../programming-guide/types/index.md) \ No newline at end of file +- [Types](../../programming-guide/types/index.md) diff --git a/docs/csharp/language-reference/keywords/value-types.md b/docs/csharp/language-reference/keywords/value-types.md index 0e975df483de7..e5a2f1a3f8d16 100644 --- a/docs/csharp/language-reference/keywords/value-types.md +++ b/docs/csharp/language-reference/keywords/value-types.md @@ -1,6 +1,6 @@ --- -title: "Value Types (C# Reference)" -ms.date: 07/20/2015 +title: "Value types (C# Reference)" +ms.date: 11/26/2018 f1_keywords: - "cs.valuetypes" helpviewer_keywords: @@ -9,44 +9,48 @@ helpviewer_keywords: - "C# language, value types" ms.assetid: 471eb994-2958-49d5-a6be-19b4313f80a3 --- -# Value Types (C# Reference) -The value types consist of two main categories: - -- [Structs](../../../csharp/language-reference/keywords/struct.md) - -- [Enumerations](../../../csharp/language-reference/keywords/enum.md) - - Structs fall into these categories: - -- Numeric types - - - [Integral types](../../../csharp/language-reference/keywords/integral-types-table.md) - - - [Floating-point types](../../../csharp/language-reference/keywords/floating-point-types-table.md) - -- [bool](../../../csharp/language-reference/keywords/bool.md) - -- User defined structs. - -## Main Features of Value Types - Variables that are based on value types directly contain values. Assigning one value type variable to another copies the contained value. This differs from the assignment of reference type variables, which copies a reference to the object but not the object itself. - - All value types are derived implicitly from the . - - Unlike with reference types, you cannot derive a new type from a value type. However, like reference types, structs can implement interfaces. - - Unlike reference types, a value type cannot contain the `null` value. However, the [nullable types](../../../csharp/programming-guide/nullable-types/index.md) feature does allow for value types to be assigned to `null`. +# Value types (C# Reference) + +There are two kinds of value types: + +- [Structs](struct.md) + +- [Enumerations](enum.md) + +## Main features of value types + +A variable of a value type contains a value of the type. For example, a variable of the `int` type might contain the value `42`. This differs from a variable of a reference type, which contains a reference to an instance of the type, also known as an object. When you assign a new value to a variable of a value type, that value is copied. When you assign a new value to a variable of a reference type, the reference is copied, not the object itself. + +All value types are derived implicitly from the . - Each value type has an implicit default constructor that initializes the default value of that type. For information about default values of value types, see [Default Values Table](../../../csharp/language-reference/keywords/default-values-table.md). +Unlike with reference types, you cannot derive a new type from a value type. However, like reference types, structs can implement interfaces. -## Main Features of Simple Types - All of the simple types -- those integral to the C# language -- are aliases of the .NET Framework System types. For example, [int](../../../csharp/language-reference/keywords/int.md) is an alias of . For a complete list of aliases, see [Built-In Types Table](../../../csharp/language-reference/keywords/built-in-types-table.md). +Value type variables cannot be `null` by default. However, variables of the corresponding [nullable types](../../../csharp/programming-guide/nullable-types/index.md) can be `null`. - Constant expressions, whose operands are all simple type constants, are evaluated at compilation time. +Each value type has an implicit default constructor that initializes the default value of that type. For information about default values of value types, see [Default values table](default-values-table.md). - Simple types can be initialized by using literals. For example, 'A' is a literal of the type `char` and 2001 is a literal of the type `int`. +## Simple types + +The *simple types* are a set of predefined struct types provided by C# and comprise the following types: + +- [Integral types](integral-types-table.md): integer numeric types and the [char](char.md) type +- [Floating-point types](floating-point-types-table.md) +- [bool](bool.md) + +The simple types are identified through keywords, but these keywords are simply aliases for predefined struct types in the namespace. For example, [int](int.md) is an alias of . For a complete list of aliases, see [Built-in types table](built-in-types-table.md). + +The simple types differ from other struct types in that they permit certain additional operations: + +- Simple types can be initialized by using literals. For example, `'A'` is a literal of the type `char` and `2001` is a literal of the type `int`. + +- You can declare constants of the simple types with the [const](const.md) keyword. It's not possible to have constants of other struct types. + +- Constant expressions, whose operands are all simple type constants, are evaluated at compile time. + +For more information, see the [Simple types](~/_csharplang/spec/types.md#simple-types) section of the [C# language specification](../language-specification/index.md). -## Initializing Value Types +## Initializing value types + Local variables in C# must be initialized before they are used. For example, you might declare a local variable without initialization as in the following example: ```csharp @@ -77,9 +81,9 @@ int myInt = new int(); int myInt = 0; ``` - Using the [new](../../../csharp/language-reference/keywords/new.md) operator calls the default constructor of the specific type and assigns the default value to the variable. In the preceding example, the default constructor assigned the value `0` to `myInt`. For more information about values assigned by calling default constructors, see [Default Values Table](../../../csharp/language-reference/keywords/default-values-table.md). + Using the [new](new.md) operator calls the default constructor of the specific type and assigns the default value to the variable. In the preceding example, the default constructor assigned the value `0` to `myInt`. For more information about values assigned by calling default constructors, see [Default values table](default-values-table.md). - With user-defined types, use [new](../../../csharp/language-reference/keywords/new.md) to invoke the default constructor. For example, the following statement invokes the default constructor of the `Point` struct: + With user-defined types, use [new](new.md) to invoke the default constructor. For example, the following statement invokes the default constructor of the `Point` struct: ```csharp Point p = new Point(); // Invoke default constructor for the struct. @@ -87,16 +91,16 @@ Point p = new Point(); // Invoke default constructor for the struct. After this call, the struct is considered to be definitely assigned; that is, all its members are initialized to their default values. - For more information about the new operator, see [new](../../../csharp/language-reference/keywords/new.md). + For more information about the `new` operator, see [new](new.md). - For information about formatting the output of numeric types, see [Formatting Numeric Results Table](../../../csharp/language-reference/keywords/formatting-numeric-results-table.md). + For information about formatting the output of numeric types, see [Formatting numeric results table](formatting-numeric-results-table.md). -## See Also +## See also -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Keywords](../../../csharp/language-reference/keywords/index.md) -- [Types](../../../csharp/language-reference/keywords/types.md) -- [Reference Tables for Types](../../../csharp/language-reference/keywords/reference-tables-for-types.md) -- [Reference Types](../../../csharp/language-reference/keywords/reference-types.md) +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Keywords](index.md) +- [Types](types.md) +- [Reference tables for types](reference-tables-for-types.md) +- [Reference Types](reference-types.md) - [Nullable types](../../programming-guide/nullable-types/index.md) diff --git a/docs/csharp/language-reference/keywords/when.md b/docs/csharp/language-reference/keywords/when.md index 4de4d4539ada2..063e8a8f5c29f 100644 --- a/docs/csharp/language-reference/keywords/when.md +++ b/docs/csharp/language-reference/keywords/when.md @@ -20,7 +20,7 @@ You can use the `when` contextual keyword to specify a filter condition in two c Starting with C# 6, `when` can be used in a `catch` statement to specify a condition that must be true for the handler for a specific exception to execute. Its syntax is: ```csharp -catch ExceptionType [e] when (expr) +catch (ExceptionType [e]) when (expr) ``` where *expr* is an expression that evaluates to a Boolean value. If it returns `true`, the exception handler executes; if `false`, it does not. diff --git a/docs/csharp/language-reference/operators/assignment-operator.md b/docs/csharp/language-reference/operators/assignment-operator.md index 47051e545e939..57837788248de 100644 --- a/docs/csharp/language-reference/operators/assignment-operator.md +++ b/docs/csharp/language-reference/operators/assignment-operator.md @@ -1,6 +1,6 @@ --- title: "= Operator (C# Reference)" -ms.date: 10/31/2018 +ms.date: 11/26/2018 f1_keywords: - "=_CSharpKeyword" helpviewer_keywords: @@ -27,6 +27,16 @@ The following example demonstrates the usage of the assignment operator to assig [!code-csharp-interactive[assignment operator](~/samples/snippets/csharp/language-reference/operators/AssignmentExamples.cs#Assignments)] +## ref assignment operator + +Beginning with C# 7.3, you can use the ref assignment operator `= ref` to reassign a [ref local](../keywords/ref.md#ref-locals) or [ref readonly local](../keywords/ref.md#ref-readonly-locals) variable. The following example demonstrates the usage of the ref assignment operator: + +[!code-csharp[ref assignment operator](~/samples/snippets/csharp/language-reference/operators/AssignmentExamples.cs#RefAssignment)] + +In the case of the ref assignment operator, the type of the left operand and the right operand must be the same. + +For more information, see the [feature proposal note](https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.3/ref-local-reassignment.md). + ## Operator overloadability A user-defined type cannot overload the assignment operator. However, a user-defined type can define an implicit conversion to another type. That way, the value of a user-defined type can be assigned to a variable, a property, or an indexer element of another type. For more information, see the [implicit](../keywords/implicit.md) keyword article. @@ -40,3 +50,4 @@ For more information, see the [Simple assignment](~/_csharplang/spec/expressions - [C# Reference](../index.md) - [C# Programming Guide](../../programming-guide/index.md) - [C# Operators](index.md) +- [ref keyword](../keywords/ref.md) diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/decrement-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/decrement-operator_1.cs deleted file mode 100644 index 6d026aa60d339..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/decrement-operator_1.cs +++ /dev/null @@ -1,18 +0,0 @@ - class MainClass5 - { - static void Main() - { - double x; - x = 1.5; - Console.WriteLine(--x); - x = 1.5; - Console.WriteLine(x--); - Console.WriteLine(x); - } - } - /* - Output: - 0.5 - 1.5 - 0.5 - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/dereference-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/dereference-operator_1.cs deleted file mode 100644 index 62844dcbfabb7..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/dereference-operator_1.cs +++ /dev/null @@ -1,22 +0,0 @@ - // compile with: -unsafe - - struct Point - { - public int x, y; - } - - class MainClass12 - { - unsafe static void Main() - { - Point pt = new Point(); - Point* pp = &pt; - pp->x = 123; - pp->y = 456; - Console.WriteLine("{0} {1}", pt.x, pt.y); - } - } - /* - Output: - 123 456 - */ diff --git a/docs/csharp/language-reference/operators/codesnippet/CSharp/increment-operator_1.cs b/docs/csharp/language-reference/operators/codesnippet/CSharp/increment-operator_1.cs deleted file mode 100644 index 21672bac734ef..0000000000000 --- a/docs/csharp/language-reference/operators/codesnippet/CSharp/increment-operator_1.cs +++ /dev/null @@ -1,19 +0,0 @@ - //++ operator - class MainClass - { - static void Main() - { - double x; - x = 1.5; - Console.WriteLine(++x); - x = 1.5; - Console.WriteLine(x++); - Console.WriteLine(x); - } - } - /* - Output - 2.5 - 1.5 - 2.5 - */ \ No newline at end of file diff --git a/docs/csharp/language-reference/operators/conditional-operator.md b/docs/csharp/language-reference/operators/conditional-operator.md index f43dfd87bc5f0..b64732e9aea30 100644 --- a/docs/csharp/language-reference/operators/conditional-operator.md +++ b/docs/csharp/language-reference/operators/conditional-operator.md @@ -42,7 +42,7 @@ The following example demonstrates the usage of the conditional operator: ## Conditional ref expression -Beginning with C# 7.2, you can use the conditional ref expression to return the reference to the result of one of the two expressions. You can assign that reference to a [local ref](../keywords/ref.md#ref-locals) or [local ref readonly](../keywords/ref.md#ref-readonly-locals) variable, or use it as a [reference return value](../keywords/ref.md#reference-return-values) or as a [`ref` method parameter](../keywords/ref.md#passing-an-argument-by-reference). +Beginning with C# 7.2, you can use the conditional ref expression to return the reference to the result of one of the two expressions. You can assign that reference to a [ref local](../keywords/ref.md#ref-locals) or [ref readonly local](../keywords/ref.md#ref-readonly-locals) variable, or use it as a [reference return value](../keywords/ref.md#reference-return-values) or as a [`ref` method parameter](../keywords/ref.md#passing-an-argument-by-reference). The syntax for the conditional ref expression is as follows: diff --git a/docs/csharp/language-reference/operators/decrement-operator.md b/docs/csharp/language-reference/operators/decrement-operator.md index 52d439b912e22..4fe795b3afc61 100644 --- a/docs/csharp/language-reference/operators/decrement-operator.md +++ b/docs/csharp/language-reference/operators/decrement-operator.md @@ -1,6 +1,6 @@ --- title: "-- Operator (C# Reference)" -ms.date: 07/20/2015 +ms.date: 11/26/2018 f1_keywords: - "--_CSharpKeyword" helpviewer_keywords: @@ -9,18 +9,39 @@ helpviewer_keywords: ms.assetid: 6b9cfe86-63c7-421f-9379-c9690fea8720 --- # -- Operator (C# Reference) -The decrement operator (`--`) decrements its operand by 1. The decrement operator can appear before or after its operand: `--variable` and `variable--`. The first form is a prefix decrement operation. The result of the operation is the value of the operand "after" it has been decremented. The second form is a postfix decrement operation. The result of the operation is the value of the operand "before" it has been decremented. - -## Remarks - Numeric and enumeration types have predefined decrement operators. - - User-defined types can overload the `--` operator (see [operator](../../../csharp/language-reference/keywords/operator.md)). Operations on integral types are generally allowed on enumeration. - -## Example - [!code-csharp[csRefOperators#8](../../../csharp/language-reference/operators/codesnippet/CSharp/decrement-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) + +The unary decrement operator `--` decrements its operand by 1. It's supported in two forms: the postfix decrement operator, `x--`, and the prefix decrement operator, `--x`. + +## Postfix decrement operator + +The result of `x--` is the value of `x` *before* the operation, as the following example shows: + +[!code-csharp-interactive[postfix decrement](~/samples/snippets/csharp/language-reference/operators/DecrementAndIncrementExamples.cs#PostfixDecrement)] + +## Prefix decrement operator + +The result of `--x` is the value of `x` *after* the operation, as the following example shows: + +[!code-csharp-interactive[prefix decrement](~/samples/snippets/csharp/language-reference/operators/DecrementAndIncrementExamples.cs#PrefixDecrement)] + +## Remarks + +The decrement operator is predefined for all [integral types](../keywords/integral-types-table.md) (including the [char](../keywords/char.md) type), [floating-point types](../keywords/floating-point-types-table.md), and any [enum](../keywords/enum.md) type. + +An operand of the decrement operator must be a variable, a [property](../../programming-guide/classes-and-structs/properties.md) access, or an [indexer](../../../csharp/programming-guide/indexers/index.md) access. + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `--` operator. + +## C# language specification + +For more information, see the [Postfix increment and decrement operators](~/_csharplang/spec/expressions.md#postfix-increment-and-decrement-operators) and [Prefix increment and decrement operators](~/_csharplang/spec/expressions.md#prefix-increment-and-decrement-operators) sections of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [++ Operator](increment-operator.md) +- [How to: increment and decrement pointers](../../programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md) diff --git a/docs/csharp/language-reference/operators/dereference-operator.md b/docs/csharp/language-reference/operators/dereference-operator.md index 81fcf156147cf..75f42cf98fe71 100644 --- a/docs/csharp/language-reference/operators/dereference-operator.md +++ b/docs/csharp/language-reference/operators/dereference-operator.md @@ -1,6 +1,6 @@ --- title: "-> Operator (C# Reference)" -ms.date: 07/20/2015 +ms.date: 11/26/2018 f1_keywords: - "->_CSharpKeyword" helpviewer_keywords: @@ -9,30 +9,36 @@ helpviewer_keywords: ms.assetid: e39ccdc1-f1ff-4a92-bf1d-ac2c8c11316a --- # -> Operator (C# Reference) -The `->` operator combines pointer dereferencing and member access. - -## Remarks - An expression of the form, - -```csharp -x->y -``` - - (where `x` is a pointer of type `T*` and `y` is a member of `T`) is equivalent to, - -```csharp -(*x).y -``` - - The `->` operator can be used only in code that is marked as [unsafe](../../../csharp/language-reference/keywords/unsafe.md). - - The `->` operator cannot be overloaded. - -## Example - [!code-csharp[csRefOperators#15](../../../csharp/language-reference/operators/codesnippet/CSharp/dereference-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) + +The pointer member access operator `->` combines pointer indirection and member access. + +If `x` is a pointer of the type `T*` and `y` is an accessible member of `T`, an expression of the form + +```csharp +x->y +``` + +is equivalent to + +```csharp +(*x).y +``` + +The `->` operator requires [unsafe](../keywords/unsafe.md) context. + +For more information, see [How to: access a member with a pointer](../../programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md). + +## Operator overloadability + +The `->` operator cannot be overloaded. + +## C# language specification + +For more information, see the [Pointer member access](~/_csharplang/spec/unsafe-code.md#pointer-member-access) section of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [Pointer types](../../programming-guide/unsafe-code-pointers/pointer-types.md) diff --git a/docs/csharp/language-reference/operators/increment-operator.md b/docs/csharp/language-reference/operators/increment-operator.md index ed3388e6a6ded..d2011eb37be7e 100644 --- a/docs/csharp/language-reference/operators/increment-operator.md +++ b/docs/csharp/language-reference/operators/increment-operator.md @@ -1,6 +1,6 @@ --- title: "++ Operator (C# Reference)" -ms.date: 07/20/2015 +ms.date: 11/26/2018 f1_keywords: - "++_CSharpKeyword" helpviewer_keywords: @@ -9,20 +9,39 @@ helpviewer_keywords: ms.assetid: e9dec353-070b-44fb-98ed-eb8fdf753feb --- # ++ Operator (C# Reference) -The increment operator (`++`) increments its operand by 1. The increment operator can appear before or after its operand: `++variable` and `variable++`. - -## Remarks - The first form is a prefix increment operation. The result of the operation is the value of the operand after it has been incremented. - - The second form is a postfix increment operation. The result of the operation is the value of the operand before it has been incremented. - - Numeric and enumeration types have predefined increment operators. User-defined types can overload the `++` operator. Operations on integral types are generally allowed on enumeration. - -## Example - [!code-csharp[csRefOperators#3](../../../csharp/language-reference/operators/codesnippet/CSharp/increment-operator_1.cs)] - -## See Also - -- [C# Reference](../../../csharp/language-reference/index.md) -- [C# Programming Guide](../../../csharp/programming-guide/index.md) -- [C# Operators](../../../csharp/language-reference/operators/index.md) + +The unary increment operator `++` increments its operand by 1. It's supported in two forms: the postfix increment operator, `x++`, and the prefix increment operator, `++x`. + +## Postfix increment operator + +The result of `x++` is the value of `x` *before* the operation, as the following example shows: + +[!code-csharp-interactive[postfix increment](~/samples/snippets/csharp/language-reference/operators/DecrementAndIncrementExamples.cs#PostfixIncrement)] + +## Prefix increment operator + +The result of `++x` is the value of `x` *after* the operation, as the following example shows: + +[!code-csharp-interactive[prefix increment](~/samples/snippets/csharp/language-reference/operators/DecrementAndIncrementExamples.cs#PrefixIncrement)] + +## Remarks + +The increment operator is predefined for all [integral types](../keywords/integral-types-table.md) (including the [char](../keywords/char.md) type), [floating-point types](../keywords/floating-point-types-table.md), and any [enum](../keywords/enum.md) type. + +An operand of the increment operator must be a variable, a [property](../../programming-guide/classes-and-structs/properties.md) access, or an [indexer](../../../csharp/programming-guide/indexers/index.md) access. + +## Operator overloadability + +User-defined types can [overload](../keywords/operator.md) the `++` operator. + +## C# language specification + +For more information, see the [Postfix increment and decrement operators](~/_csharplang/spec/expressions.md#postfix-increment-and-decrement-operators) and [Prefix increment and decrement operators](~/_csharplang/spec/expressions.md#prefix-increment-and-decrement-operators) sections of the [C# language specification](../language-specification/index.md). + +## See also + +- [C# Reference](../index.md) +- [C# Programming Guide](../../programming-guide/index.md) +- [C# Operators](index.md) +- [-- Operator](decrement-operator.md) +- [How to: increment and decrement pointers](../../programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md) diff --git a/docs/csharp/programming-guide/concepts/linq/codesnippet/CSharp/introduction-to-linq-queries_1.cs b/docs/csharp/programming-guide/concepts/linq/codesnippet/CSharp/introduction-to-linq-queries_1.cs index 82f541e95d47b..03d9626121b98 100644 --- a/docs/csharp/programming-guide/concepts/linq/codesnippet/CSharp/introduction-to-linq-queries_1.cs +++ b/docs/csharp/programming-guide/concepts/linq/codesnippet/CSharp/introduction-to-linq-queries_1.cs @@ -3,7 +3,7 @@ class IntroToLINQ static void Main() { // The Three Parts of a LINQ Query: - // 1. Data source. + // 1. Data source. int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 }; // 2. Query creation. @@ -19,4 +19,4 @@ from num in numbers Console.Write("{0,1} ", num); } } - } \ No newline at end of file + } diff --git a/docs/csharp/programming-guide/namespaces/index.md b/docs/csharp/programming-guide/namespaces/index.md index d9233c2033019..8d17183619a38 100644 --- a/docs/csharp/programming-guide/namespaces/index.md +++ b/docs/csharp/programming-guide/namespaces/index.md @@ -32,8 +32,8 @@ Namespaces have the following properties: - They organize large code projects. - They are delimited by using the `.` operator. -- The `using directive` obviates the requirement to specify the name of the namespace for every class. -- The `global` namespace is the "root" namespace: `global::System` will always refer to the .NET Framework namespace `System`. +- The `using` directive obviates the requirement to specify the name of the namespace for every class. +- The `global` namespace is the "root" namespace: `global::System` will always refer to the .NET namespace. ## C# Language Specification @@ -50,4 +50,3 @@ Namespaces have the following properties: - [using Directive](../../language-reference/keywords/using-directive.md) - [:: Operator](../../language-reference/operators/namespace-alias-qualifer.md) - [. Operator](../../language-reference/operators/member-access-operator.md) ->>>>>>> add identifier naming rules diff --git a/docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md b/docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md index 1249542307c71..6fd9ed330d1a8 100644 --- a/docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md +++ b/docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md @@ -1,23 +1,23 @@ --- -title: "Arithmetic Operations on Pointers (C# Programming Guide)" +title: "Arithmetic operations on pointers (C# Programming Guide)" ms.date: 07/20/2015 helpviewer_keywords: - "pointers [C#], arithmetic operations" ms.assetid: d4f0b623-827e-45ce-8649-cfcebc8692aa --- -# Arithmetic Operations on Pointers (C# Programming Guide) -This topic discusses using the arithmetic operators `+` and **-** to manipulate pointers. +# Arithmetic operations on pointers (C# Programming Guide) +This topic discusses using the arithmetic operators `+` and `-` to manipulate pointers. > [!NOTE] > You cannot perform any arithmetic operations on void pointers. -## Adding and Subtracting Numeric Values to or From Pointers - You can add a value `n` of type [int](../../../csharp/language-reference/keywords/int.md), [uint](../../../csharp/language-reference/keywords/uint.md), [long](../../../csharp/language-reference/keywords/long.md), or [ulong](../../../csharp/language-reference/keywords/ulong.md) to a pointer, `p`,of any type except `void*`. The result `p+n` is the pointer resulting from adding `n * sizeof(p) to the address of p`. Similarly, `p-n` is the pointer resulting from subtracting `n * sizeof(p)` from the address of `p`. +## Adding and subtracting numeric values to or from pointers + You can add a value `n` of type [int](../../../csharp/language-reference/keywords/int.md), [uint](../../../csharp/language-reference/keywords/uint.md), [long](../../../csharp/language-reference/keywords/long.md), or [ulong](../../../csharp/language-reference/keywords/ulong.md) to a pointer. If `p` is a pointer of the type `pointer-type*`, the result `p+n` is the pointer resulting from adding `n * sizeof(pointer-type)` to the address of `p`. Similarly, `p-n` is the pointer resulting from subtracting `n * sizeof(pointer-type)` from the address of `p`. -## Subtracting Pointers +## Subtracting pointers You can also subtract pointers of the same type. The result is always of the type `long`. For example, if `p1` and `p2` are pointers of the type `pointer-type*`, then the expression `p1-p2` results in: - `((long)p1 - (long)p2)/sizeof(pointer_type)` + `((long)p1 - (long)p2)/sizeof(pointer-type)` No exceptions are generated when the arithmetic operation overflows the domain of the pointer, and the result depends on the implementation. @@ -26,10 +26,10 @@ This topic discusses using the arithmetic operators `+` and **-** to manipulate [!code-csharp[csProgGuidePointers#15](../../../csharp/programming-guide/unsafe-code-pointers/codesnippet/CSharp/arithmetic-operations-on-pointers_2.cs)] -## C# Language Specification +## C# language specification [!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)] -## See Also +## See also - [C# Programming Guide](../../../csharp/programming-guide/index.md) - [Unsafe Code and Pointers](../../../csharp/programming-guide/unsafe-code-pointers/index.md) diff --git a/docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md b/docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md index 76146e490a92b..3b4a1a61a7109 100644 --- a/docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md +++ b/docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md @@ -1,11 +1,11 @@ --- -title: "How to: Access a Member with a Pointer (C# Programming Guide)" +title: "How to: access a member with a pointer (C# Programming Guide)" ms.date: 07/20/2015 helpviewer_keywords: - "pointers [C#], member access" ms.assetid: 1e998498-8c85-4a78-8ce2-4d8c20f08342 --- -# How to: Access a Member with a Pointer (C# Programming Guide) +# How to: access a member with a pointer (C# Programming Guide) To access a member of a struct that is declared in an unsafe context, you can use the member access operator as shown in the following example in which `p` is a pointer to a [struct](../../../csharp/language-reference/keywords/struct.md) that contains a member `x`. ``` diff --git a/docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md b/docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md index 7ea57031aa83d..a53c78e07aedd 100644 --- a/docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md +++ b/docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md @@ -1,15 +1,16 @@ --- -title: "How to: Increment and Decrement Pointers (C# Programming Guide)" +title: "How to: increment and decrement pointers (C# Programming Guide)" ms.date: 07/20/2015 helpviewer_keywords: - "pointers [C#], increment and decrement" - "pointer expressions [C#], increment and decrement" ms.assetid: 1b8b9281-44ee-485a-9045-3db38a4b4b89 --- -# How to: Increment and Decrement Pointers (C# Programming Guide) -Use the increment and the decrement operators, `++` and `--`, to change the pointer location by [sizeof](../../../csharp/language-reference/keywords/sizeof.md) (`pointer-type`) for a pointer of type pointer-type*. The increment and decrement expressions take the following form: +# How to: increment and decrement pointers (C# Programming Guide) + +Use the increment and the decrement operators, `++` and `--`, to change the pointer location by `sizeof(pointer-type)` for a pointer of the type `pointer-type*`. The increment and decrement expressions take the following form: -``` +```csharp ++p; p++; --p; @@ -18,9 +19,9 @@ p--; The increment and decrement operators can be applied to pointers of any type except the type `void*`. - The effect of applying the increment operator to a pointer of the type `pointer-type` is to add [sizeof](../../../csharp/language-reference/keywords/sizeof.md) (`pointer-type`) to the address that is contained in the pointer variable. + The effect of applying the increment operator to a pointer of the type `pointer-type*` is to add `sizeof(pointer-type)` to the address that is contained in the pointer variable. - The effect of applying the decrement operator to a pointer of the type `pointer-type` is to subtract `sizeof` (`pointer-type`) from the address that is contained in the pointer variable. + The effect of applying the decrement operator to a pointer of the type `pointer-type*` is to subtract `sizeof(pointer-type)` from the address that is contained in the pointer variable. No exceptions are generated when the operation overflows the domain of the pointer, and the result depends on the implementation. @@ -37,7 +38,7 @@ p--; **Value:3 @ Address:12860284** **Value:4 @ Address:12860288** -## See Also +## See also - [C# Programming Guide](../../../csharp/programming-guide/index.md) - [Pointer Expressions](../../../csharp/programming-guide/unsafe-code-pointers/pointer-expressions.md) @@ -48,3 +49,4 @@ p--; - [unsafe](../../../csharp/language-reference/keywords/unsafe.md) - [fixed Statement](../../../csharp/language-reference/keywords/fixed-statement.md) - [stackalloc](../../../csharp/language-reference/keywords/stackalloc.md) +- [sizeof](../../../csharp/language-reference/keywords/sizeof.md) diff --git a/docs/csharp/programming-guide/unsafe-code-pointers/pointer-types.md b/docs/csharp/programming-guide/unsafe-code-pointers/pointer-types.md index 80740d492c154..c6776a8b5ed01 100644 --- a/docs/csharp/programming-guide/unsafe-code-pointers/pointer-types.md +++ b/docs/csharp/programming-guide/unsafe-code-pointers/pointer-types.md @@ -14,10 +14,10 @@ type* identifier; void* identifier; //allowed but not recommended ``` -The type specified before the `*` in a pointer type is called the **referrent type**. Any of the following types may be a referrent type: +The type specified before the `*` in a pointer type is called the **referent type**. Any of the following types may be a referent type: - Any integral type: [sbyte](../../language-reference/keywords/sbyte.md), [byte](../../language-reference/keywords/byte.md), [short](../../language-reference/keywords/short.md), [ushort](../../language-reference/keywords/ushort.md), [int](../../language-reference/keywords/int.md), [uint](../../language-reference/keywords/uint.md), [long](../../language-reference/keywords/long.md), [ulong](../../language-reference/keywords/ulong.md). -- Any floating point type: [float](../../language-reference/keywords/float.md), [double](../../language-reference/keywords/double.md). +- Any floating-point type: [float](../../language-reference/keywords/float.md), [double](../../language-reference/keywords/double.md). - [char](../../language-reference/keywords/char.md). - [bool](../../language-reference/keywords/bool.md). - [decimal](../../language-reference/keywords/decimal.md). diff --git a/docs/csharp/tutorials/intro-to-csharp/numbers-in-csharp.yml b/docs/csharp/tutorials/intro-to-csharp/numbers-in-csharp.yml index adc1ddb1c8bcc..c2ed2c00bd4e2 100644 --- a/docs/csharp/tutorials/intro-to-csharp/numbers-in-csharp.yml +++ b/docs/csharp/tutorials/intro-to-csharp/numbers-in-csharp.yml @@ -94,7 +94,7 @@ items: int a = 5; int b = 4; int c = 2; - int d = (a + b) * c; + int d = (a + b) * c; Console.WriteLine(d); ``` diff --git a/docs/csharp/tutorials/working-with-linq.md b/docs/csharp/tutorials/working-with-linq.md index dbd7d53ee3400..9c97eab402296 100644 --- a/docs/csharp/tutorials/working-with-linq.md +++ b/docs/csharp/tutorials/working-with-linq.md @@ -101,7 +101,7 @@ The multiple `from` clauses produce a Ranks(rank => new { Suit = suit, Rank = rank })); +var startingDeck = Suits().SelectMany(suit => Ranks().Select(rank => new { Suit = suit, Rank = rank })); ``` The compiler translates LINQ statements written with query syntax into the equivalent method call syntax. Therefore, regardless of your syntax choice, the two versions of the query produce the same result. Choose which syntax works best for your situation: for instance, if you're working in a team where some of the members have difficulty with method syntax, try to prefer using query syntax. @@ -339,4 +339,4 @@ For more information on LINQ, see: - [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) \ No newline at end of file + - [C# Features That Support LINQ](../programming-guide/concepts/linq/features-that-support-linq.md) diff --git a/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md b/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md index f8cfe65566149..12d9a53995721 100644 --- a/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md +++ b/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md @@ -71,12 +71,12 @@ The `sku` attribute uses a target framework moniker (TFM) to indicate the versio |----------------------------|---------------------| |4.0|".NETFramework,Version=v4.0"| |4.0, Client Profile|".NETFramework,Version=v4.0,Profile=Client"| -|4.0, platform update 1|.NETFramework,Version=v4.0.1| -|4.0, Client Profile, update 1|.NETFramework,Version=v4.0.1,Profile=Client| -|4.0, platform update 2|.NETFramework,Version=v4.0.2| -|4.0, Client Profile, update 2|.NETFramework,Version=v4.0.2,Profile=Client| -|4.0, platform update 3|.NETFramework,Version=v4.0.3| -|4.0, Client Profile, update 3|.NETFramework,Version=v4.0.3,Profile=Client| +|4.0, platform update 1|".NETFramework,Version=v4.0.1"| +|4.0, Client Profile, update 1|".NETFramework,Version=v4.0.1,Profile=Client"| +|4.0, platform update 2|".NETFramework,Version=v4.0.2"| +|4.0, Client Profile, update 2|".NETFramework,Version=v4.0.2,Profile=Client"| +|4.0, platform update 3|".NETFramework,Version=v4.0.3"| +|4.0, Client Profile, update 3|".NETFramework,Version=v4.0.3,Profile=Client"| |4.5|".NETFramework,Version=v4.5"| |4.5.1|".NETFramework,Version=v4.5.1"| |4.5.2|".NETFramework,Version=v4.5.2"| diff --git a/docs/framework/configure-apps/file-schema/wcf/findcriteria.md b/docs/framework/configure-apps/file-schema/wcf/findcriteria.md index cd9f0a5bc2537..8499259514120 100644 --- a/docs/framework/configure-apps/file-schema/wcf/findcriteria.md +++ b/docs/framework/configure-apps/file-schema/wcf/findcriteria.md @@ -40,7 +40,7 @@ A configuration element that supplies a set of criteria used by a client applica |Attribute|Description| |---------------|-----------------| -|duration|A Timespan value that specifies the maximum time to wait for replies from services on the network. The default duration is 20 seconds..| +|duration|A Timespan value that specifies the maximum time to wait for replies from services on the network. The default duration is 20 seconds.| |maxResults|An integer that specifies the maximum number of replies to wait for, from services on a network or the Internet. If maximum replies are received before the value specified in the `duration` attribute has elapsed, the find operation ends.| |scopeMatchBy|A URI that specify the matching algorithm to use while matching the scopes in the Probe message with that of the endpoint.

There are five supported scope-matching rules. If you do not specify a scope-matching rule, `ScopeMatchByPrefix` is used. For more information on this, see .| @@ -48,7 +48,7 @@ A configuration element that supplies a set of criteria used by a client applica |Element|Description| |-------------|-----------------| -|[\](../../../../../docs/framework/configure-apps/file-schema/wcf/contracttypenames.md)|A collection of configuration elements that contain the names of workflow service contract types..| +|[\](../../../../../docs/framework/configure-apps/file-schema/wcf/contracttypenames.md)|A collection of configuration elements that contain the names of workflow service contract types.| |\ of \|A collection of XML element objects that provide extensions.| |[\](../../../../../docs/framework/configure-apps/file-schema/wcf/scopes.md)|A collection of objects that contain absolute URIs that are used during a find operation to locate a specific service or services.

If the specific service is found, a successful match has been made between the service URI and the Scope URI, sometimes with the help of scope rules that handle complications of matching.| diff --git a/docs/framework/configure-apps/file-schema/wcf/message-of-wsdualhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/message-of-wsdualhttpbinding.md index c7ebbdbcbe1ee..077e766c6512c 100644 --- a/docs/framework/configure-apps/file-schema/wcf/message-of-wsdualhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/message-of-wsdualhttpbinding.md @@ -46,7 +46,7 @@ Defines message-level security for the [\](../../../../../doc |Basic256|Use Aes256 encryption, Sha1 for message digest, Rsa-oaep-mgf1p for key wrap.| |Basic256Rsa15|Use Aes256 for message encryption, Sha1 for message digest and Rsa15 for key wrap.| |Basic192Rsa15|Use Aes192 for message encryption, Sha1 for message digest and Rsa15 for key wrap.| -|TripleDes|Use TripleDes encryption, , Sha1 for message digest, Rsa-oaep-mgf1p for key wrap.| +|TripleDes|Use TripleDes encryption, Sha1 for message digest, Rsa-oaep-mgf1p for key wrap.| |Basic128Rsa15|Use Aes128 for message encryption, Sha1 for message digest and Rsa15 for key wrap.| |TripleDesRsa15|Use TripleDes encryption, Sha1 for message digest and Rsa15 for key wrap.| |Basic128Sha256|Use Aes256 for message encryption, Sha256 for message digest and Rsa-oaep-mgf1p for key wrap.| diff --git a/docs/framework/configure-apps/file-schema/wcf/msmqintegration.md b/docs/framework/configure-apps/file-schema/wcf/msmqintegration.md index 8b47eb92f5b67..90175cedcbe16 100644 --- a/docs/framework/configure-apps/file-schema/wcf/msmqintegration.md +++ b/docs/framework/configure-apps/file-schema/wcf/msmqintegration.md @@ -52,7 +52,7 @@ Specifies a MSMQ transport for custom binding. |exactlyOnce|A Boolean that specifies whether messages processed by this binding will be received exactly once. The default is `true`.

A message can be sent with or without assurances. An assurance enables an application to ensure that a sent message reached the receiving message queue, or if it did not, the application can determine this by reading the dead letter queue.

`exactlyOnce`, when set to `true`, indicates that MSMQ will ensure that a sent message is delivered to the receiving message queue once and only once, and if delivery fails, the message is sent to the dead letter queue.

Messages sent with `exactlyOnce` set to `true` must be sent to a transactional queue only.| |manualAddressing|A Boolean value that enables the user to take control of message addressing. This property is usually used in router scenarios, where the application determines which one of several destinations to send a message to.

When set to `true`, the channel assumes the message has already been addressed and does not add any additional information to it. The user can then address every message individually.

When set to `false`, the default Windows Communication Foundation (WCF) addressing mechanism automatically creates addresses for all messages.

The default is `false`.| |maxBufferPoolSize|A positive integer that specifies the maximum size of the buffer pool. The default is 524288.

Many parts of WCF use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| -|maxImmediateRetries|An integer that specifies the maximum number of immediate retry attempts on a message that is read from the application queue.. The default is 5.

If the maximum number of immediate retries for the message is attempted and the message is not consumed by the application, then the message is sent to a retry queue for retrying at some later point in time. If no retry cycles are specified, then the messages is either sent to the poison message queue, or a negative acknowledgment is sent back to the sender.| +|maxImmediateRetries|An integer that specifies the maximum number of immediate retry attempts on a message that is read from the application queue. The default is 5.

If the maximum number of immediate retries for the message is attempted and the message is not consumed by the application, then the message is sent to a retry queue for retrying at some later point in time. If no retry cycles are specified, then the messages is either sent to the poison message queue, or a negative acknowledgment is sent back to the sender.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size in bytes including headers. The sender of a message receives a SOAP fault when the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |maxRetryCycles|An integer that specifies the maximum number of retry cycles to attempt delivery of messages to the receiving application. The default is .

A single retry cycle attempts to deliver a message to an application a specified number of times. The number of attempts made is set by the `maxImmediateRetries` attribute. If the application fails to consume the message after the attempts at delivery have been exhausted, the message is sent to a retry queue. Subsequent retry cycles consist of the message being returned from the retry queue to the application queue to attempt delivery to the application again, after a delay specified by the `retryCycleDelay` attribute. The `maxRetryCycles` attribute specifies the number of retry cycles the application uses to attempt to deliver the message.| |rejectAfterLastRetry|A Boolean value that specifies what action to take for a message that has failed delivery after the maximum number of retries have been attempted.

`true` means that a negative acknowledgment is returned to the sender and the message is dropped; `false` means that the message is sent to the poison message queue. The default is `false`.

If the value is `false`, the receiving application can read the poison message queue to process poison messages (that is, messages that have failed delivery).

MSMQ 3.0 does not support returning a negative acknowledgment to the sender, so this attribute will be ignored in MSMQ 3.0.| diff --git a/docs/framework/configure-apps/file-schema/wcf/msmqtransport.md b/docs/framework/configure-apps/file-schema/wcf/msmqtransport.md index 87e66eb1c3ad4..043a068c0820a 100644 --- a/docs/framework/configure-apps/file-schema/wcf/msmqtransport.md +++ b/docs/framework/configure-apps/file-schema/wcf/msmqtransport.md @@ -51,7 +51,7 @@ Causes a channel to transfers messages on the MSMQ transport when it is included |exactlyOnce|A Boolean that specifies whether messages processed by this binding will be received exactly once. The default is `true`.

A message can be sent with or without assurances. An assurance enables an application to ensure that a sent message reached the receiving message queue, or if it did not, the application can determine this by reading the dead letter queue.

`exactlyOnce`, when set to `true`, indicates that MSMQ will ensure that a sent message is delivered to the receiving message queue once and only once, and if delivery fails, the message is sent to the dead letter queue.

Messages sent with `exactlyOnce` set to `true` must be sent to a transactional queue only.| |manualAddressing|A Boolean value that enables the user to take control of message addressing. This property is usually used in router scenarios, where the application determines which one of several destinations to send a message to.

When set to `true`, the channel assumes the message has already been addressed and does not add any additional information to it. The user can then address every message individually.

When set to `false`, the default Windows Communication Foundation (WCF) addressing mechanism automatically creates addresses for all messages.

The default is `false`.| |maxBufferPoolSize|A positive integer that specifies the maximum size of the buffer pool. The default is 524288.

Many parts of WCF use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| -|maxImmediateRetries|An integer that specifies the maximum number of immediate retry attempts on a message that is read from the application queue.. The default is 5.

If the maximum number of immediate retries for the message is attempted and the message is not consumed by the application, then the message is sent to a retry queue for retrying at some later point in time. If no retry cycles are specified, then the messages is either sent to the poison message queue, or a negative acknowledgment is sent back to the sender.| +|maxImmediateRetries|An integer that specifies the maximum number of immediate retry attempts on a message that is read from the application queue. The default is 5.

If the maximum number of immediate retries for the message is attempted and the message is not consumed by the application, then the message is sent to a retry queue for retrying at some later point in time. If no retry cycles are specified, then the messages is either sent to the poison message queue, or a negative acknowledgment is sent back to the sender.| |maxPoolSize|A positive integer that specifies the maximum size of the pool. The default is 524288.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size in bytes including headers. The sender of a message receives a SOAP fault when the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |maxRetryCycles|An integer that specifies the maximum number of retry cycles to attempt delivery of messages to the receiving application. The default is .

A single retry cycle attempts to deliver a message to an application a specified number of times. The number of attempts made is set by the `maxImmediateRetries` attribute. If the application fails to consume the message after the attempts at delivery have been exhausted, the message is sent to a retry queue. Subsequent retry cycles consist of the message being returned from the retry queue to the application queue to attempt delivery to the application again, after a delay specified by the `retryCycleDelay` attribute. The `maxRetryCycles` attribute specifies the number of retry cycles the application uses to attempt to deliver the message.| diff --git a/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md index 90e252b88a0f0..0308243df442f 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md @@ -133,7 +133,7 @@ Represents a binding that a Windows Communication Foundation (WCF) service can u ``` ## Example - Starting with [!INCLUDE[netfx40_short](../../../../../includes/netfx40-short-md.md)], bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name frm the binding. + Starting with [!INCLUDE[netfx40_short](../../../../../includes/netfx40-short-md.md)], bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. ```xml diff --git a/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md b/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md index b6bd667d094af..2f3e95c4a5a7a 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md @@ -130,7 +130,7 @@ Next Element ``` ## Example - Starting with [!INCLUDE[netfx40_short](../../../../../includes/netfx40-short-md.md)], bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name frm the binding. + Starting with [!INCLUDE[netfx40_short](../../../../../includes/netfx40-short-md.md)], bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. ```xml diff --git a/docs/framework/data/adonet/local-transactions.md b/docs/framework/data/adonet/local-transactions.md index 4baf9ec0f5a86..90e5cadeb8a01 100644 --- a/docs/framework/data/adonet/local-transactions.md +++ b/docs/framework/data/adonet/local-transactions.md @@ -15,7 +15,7 @@ Transactions in [!INCLUDE[vstecado](../../../../includes/vstecado-md.md)] are us Each of the [!INCLUDE[dnprdnshort](../../../../includes/dnprdnshort-md.md)] data providers has its own `Transaction` object for performing local transactions. If you require a transaction to be performed in a SQL Server database, select a transaction. For an Oracle transaction, use the provider. In addition, there is a class that is available for writing provider-independent code that requires transactions. > [!NOTE] -> Transactions are most efficient when it is performed on the server. If you are working with a SQL Server database that makes extensive use of explicit transactions, consider writing them as stored procedures using the Transact-SQL BEGIN TRANSACTION statement. +> Transactions are most efficient when they are performed on the server. If you are working with a SQL Server database that makes extensive use of explicit transactions, consider writing them as stored procedures using the Transact-SQL BEGIN TRANSACTION statement. ## Performing a Transaction Using a Single Connection In [!INCLUDE[vstecado](../../../../includes/vstecado-md.md)], you control transactions with the `Connection` object. You can initiate a local transaction with the `BeginTransaction` method. Once you have begun a transaction, you can enlist a command in that transaction with the `Transaction` property of a `Command` object. You can then commit or roll back modifications made at the data source based on the success or failure of the components of the transaction. diff --git a/docs/framework/interop/com-callable-wrapper.md b/docs/framework/interop/com-callable-wrapper.md index aab4cf559e5a1..8c831d6c54149 100644 --- a/docs/framework/interop/com-callable-wrapper.md +++ b/docs/framework/interop/com-callable-wrapper.md @@ -135,8 +135,9 @@ End Class ```csharp [ClassInterface(ClassInterfaceType.None)] -public class LoanApp : IExplicit { - public void M() {} +public class LoanApp : IExplicit +{ + int IExplicit.M() { return 0; } } ``` @@ -159,8 +160,9 @@ End Class ```csharp [ClassInterface(ClassInterfaceType.AutoDispatch)] -public class LoanApp : IAnother { - public void M() {} +public class LoanApp +{ + public int M() { return 0; } } ``` diff --git a/docs/fsharp/language-reference/discriminated-unions.md b/docs/fsharp/language-reference/discriminated-unions.md index 3d03e55d7349d..3049868adf7b5 100644 --- a/docs/fsharp/language-reference/discriminated-unions.md +++ b/docs/fsharp/language-reference/discriminated-unions.md @@ -89,10 +89,18 @@ The following example demonstrates this: ```fsharp type ShaderProgram = | ShaderProgram of id:int -let someMethodUsingShaderProgram shaderProgram = +let someFunctionUsingShaderProgram shaderProgram = let (ShaderProgram id) = shaderProgram // Use the unwrapped value - .. + ... +``` + +Pattern matching is also allowed directly in function parameters, so you can unwrap a single case there: + +```fsharp +let someFunctionUsingShaderProgram (ShaderProgram id) = + // Use the unwrapped value + ... ``` ## Struct Discriminated Unions diff --git a/docs/fsharp/language-reference/literals.md b/docs/fsharp/language-reference/literals.md index a9d1457394279..7fcb2c321f0f7 100644 --- a/docs/fsharp/language-reference/literals.md +++ b/docs/fsharp/language-reference/literals.md @@ -45,16 +45,16 @@ As of F# 3.1, you can use the `+` sign to combine string literals. You can also ```fsharp [] -let Literal1 = "a" + "b" +let literal1 = "a" + "b" [] -let FileLocation = __SOURCE_DIRECTORY__ + "/" + __SOURCE_FILE__ +let fileLocation = __SOURCE_DIRECTORY__ + "/" + __SOURCE_FILE__ [] -let Literal2 = 1 ||| 64 +let literal2 = 1 ||| 64 [] -let Literal3 = System.IO.FileAccess.Read ||| System.IO.FileAccess.Write +let literal3 = System.IO.FileAccess.Read ||| System.IO.FileAccess.Write ``` The use of other bitwise operators isn't allowed. @@ -79,11 +79,11 @@ let Numbers = (0x9F, 0o77, 0b1010) Starting with F# 4.1, you can separate digits with the underscore character (`_`). ```fsharp -let DeadBeef = 0xDEAD_BEEF +let value = 0xDEAD_BEEF -let DeadBeefAsBits = 0b1101_1110_1010_1101_1011_1110_1110_1111 +let valueAsBits = 0b1101_1110_1010_1101_1011_1110_1110_1111 -let ExampleSSN = 123_456_7890 +let exampleSSN = 123_456_7890 ``` ## See also diff --git a/docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md b/docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md index 46c73bf8fcbed..41cefcaec229f 100644 --- a/docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md +++ b/docs/fsharp/language-reference/symbol-and-operator-reference/arithmetic-operators.md @@ -28,6 +28,7 @@ The following table summarizes the unary arithmetic operators that are available |--------------|-----| |`+` (positive)|Can be applied to any arithmetic expression. Does not change the sign of the value.| |`-` (negation, negative)|Can be applied to any arithmetic expression. Changes the sign of the value.| + The behavior at overflow or underflow for integral types is to wrap around. This causes an incorrect result. Integer overflow is a potentially serious problem that can contribute to security issues when software is not written to account for it. If this is a concern for your application, consider using the checked operators in `Microsoft.FSharp.Core.Operators.Checked`. ## Summary of Binary Comparison Operators diff --git a/docs/fsharp/style-guide/formatting.md b/docs/fsharp/style-guide/formatting.md index 6c8a017fb3536..f925409ee7da0 100644 --- a/docs/fsharp/style-guide/formatting.md +++ b/docs/fsharp/style-guide/formatting.md @@ -1,7 +1,7 @@ --- title: F# code formatting guidelines description: Learn guidelines for formatting F# code. -ms.date: 05/14/2018 +ms.date: 11/26/2018 --- # F# code formatting guidelines @@ -25,6 +25,63 @@ When indentation is required, you must use spaces, not tabs. At least one space That said, indentation of programs is a subjective matter. Variations are OK, but the first rule you should follow is *consistency of indentation*. Choose a generally accepted style of indentation and use it systematically throughout your codebase. +## Formatting white space + +F# is white space sensitive. Although most semantics from white space are covered by proper indentation, there are some other things to consider. + +### Formatting operators in arithmetic expressions + +Always use white space around binary arithmetic expressions: + +```fsharp +let subtractThenAdd x = x - 1 + 3 +``` + +Unary `-` operators should always have the value they are negating immediately follow: + +```fsharp +// OK +let negate x = -x + +// Bad +let negateBad x = - x +``` + +Adding a white-space character after the `-` operator can lead to confusion for others. + +In summary, it's important to always: + +* Surround binary operators with white space +* Never have trailing white space after a unary operator + +The binary arithmetic operator guideline is especially important. Failing to surround a binary `-` operator, when combined with certain formatting choices, could lead to interpreting it as a unary `-`. + +### Surround a custom operator definition with white space + +Always use white space to surround an operator definition: + +```fsharp +// OK +let ( !> ) x f = f x + +// Bad +let (!>) x f = f x +``` + +For any custom operator that starts with `*`, you'll need to add a white space to the beginning of the definition to avoid a compiler ambiguity. Because of this, it's recommended that you simply surround the definitions of all operators with a single white-space character. + +### Surround function parameter arrows with white space + +When defining the signature of a function, use white space around the `->` symbol: + +```fsharp +// OK +type MyFun = int -> int -> string + +// Bad +type MyFunBad = int->int->string +``` + ## Formatting blank lines * Separate top-level function and class definitions with two blank lines. @@ -405,13 +462,13 @@ Use a `|` for each clause of a match with no indentation. If the expression is s ```fsharp // OK match l with -| { him = x; her = "Posh" } :: tail -> _ +| { him = x; her = "Posh" } :: tail -> x | _ :: tail -> findDavid tail | [] -> failwith "Couldn't find David" // Not OK match l with - | { him = x; her = "Posh" } :: tail -> _ + | { him = x; her = "Posh" } :: tail -> x | _ :: tail -> findDavid tail | [] -> failwith "Couldn't find David" ``` @@ -646,3 +703,17 @@ type MyRecord = ``` When applied to a parameter, they must be on the same line and separated by a `;` separator. + +## Formatting literals + +[F# literals](../language-reference/literals.md) using the `Literal` attribute should should place the attribute on its own line and use camelCase naming: + +```fsharp +[] +let path = __SOURCE_DIRECTORY__ + "/" + __SOURCE_FILE__ + +[] +let myUrl = "www.mywebsitethatiamworkingwith.com" +``` + +Avoid placing the attribute on the same line as the value. diff --git a/docs/machine-learning/tutorials/sentiment-analysis.md b/docs/machine-learning/tutorials/sentiment-analysis.md index 6dcb5be1f7301..7bd378afc122f 100644 --- a/docs/machine-learning/tutorials/sentiment-analysis.md +++ b/docs/machine-learning/tutorials/sentiment-analysis.md @@ -222,7 +222,7 @@ Add the following code to the `Train` method: At this point, you have a model of type that can be integrated into any of your existing or new .NET applications. Return the model at the end of the `Train` method. -[!code-csharp[ReturnModel](../../../samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#11 "Return the model")] +[!code-csharp[ReturnModel](../../../samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#10 "Return the model")] ## Evaluate the model @@ -298,7 +298,7 @@ Console.WriteLine("The model is saved to {0}", _modelPath); Create the `Predict` method, just after the `Evaluate` method, using the following code: ```csharp -public static void Predict(PredictionModel model) +private static void Predict(MLContext mlContext, ITransformer model) { } @@ -326,7 +326,7 @@ Add a comment to test the trained model's prediction in the `Predict` method by You can use that to predict the Toxic or Non Toxic sentiment of a single instance of the comment data. To get a prediction, use on the data. Note that the input data is a string and the model includes the featurization. Your pipeline is in sync during training and prediction. You didn’t have to write preprocessing/featurization code specifically for predictions, and the same API takes care of both batch and one-time predictions. -[!code-csharp[Predict](../../../samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#18 "Create a prediction of sentiment")] +[!code-csharp[Predict](../../../samples/machine-learning/tutorials/SentimentAnalysis/Program.cs#19 "Create a prediction of sentiment")] ### Model operationalization: prediction diff --git a/docs/machine-learning/tutorials/taxi-fare.md b/docs/machine-learning/tutorials/taxi-fare.md index 1ceb751b054e2..ddfb89b8db975 100644 --- a/docs/machine-learning/tutorials/taxi-fare.md +++ b/docs/machine-learning/tutorials/taxi-fare.md @@ -85,9 +85,9 @@ Remove the existing class definition and add the following code, which has two c [!code-csharp[DefineTaxiTrip](../../../samples/machine-learning/tutorials/TaxiFarePrediction/TaxiTrip.cs#2 "Define the taxi trip and fare predictions classes")] -`TaxiTrip` is the input data class and has definitions for each of the data set columns. Use the [Column] attribute to specify the indices of the source columns in the data set. +`TaxiTrip` is the input data class and has definitions for each of the data set columns. Use the attribute to specify the indices of the source columns in the data set. -The `TaxiTripFarePrediction` class represents predicted results. It has a single float field, `FareAmount`, with a `Score` [ColumnName] attribute applied. In case of the regression task the **Score** column contains predicted label values. +The `TaxiTripFarePrediction` class represents predicted results. It has a single float field, `FareAmount`, with a `Score` attribute applied. In case of the regression task the **Score** column contains predicted label values. > [!NOTE] > Use the `float` type to represent floating-point values in the input and prediction data classes. @@ -225,10 +225,6 @@ Console.WriteLine("The model is saved to {0}", _modelPath); Evaluation is the process of checking how well the model predicts label values. It's important that the model makes good predictions on data that was not used to train the model. One way to do this is to split the data into training and test data sets, as it's done in this tutorial. Now that you've trained the model on the training data, you can see how well it performs on the test data. -Go back to the `Main` method and add the following code beneath the call to the `Train`method: - -[!code-csharp[Evaluate](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#10 "Evaluate the model.")] - The `Evaluate` method evaluates the model. To create that method, add the following code below the `Train` method: ```csharp @@ -246,19 +242,19 @@ The `Evaluate` method executes the following tasks: Add a call to the new method from the `Main` method, right under the `Train` method call, using the following code: -[!code-csharp[CallEvaluate](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#11 "Call the Evaluate method")] +[!code-csharp[CallEvaluate](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#14 "Call the Evaluate method")] We'll load the test dataset using the previously initialized `_textLoader` global variable with the `_testDataPath` global field. You can evaluate the model using this dataset as a quality check. Add the following code to the `Evaluate` method: -[!code-csharp[LoadTestDataset](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#14 "Load the test dataset")] +[!code-csharp[LoadTestDataset](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#15 "Load the test dataset")] Next, we'll use the machine learning `model` parameter (a transformer) to input the features and return predictions. Add the following code to the `Evaluate` method as the next line: -[!code-csharp[PredictWithTransformer](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#15 "Predict using the Transformer")] +[!code-csharp[PredictWithTransformer](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#16 "Predict using the Transformer")] The `RegressionContext.Evaluate` method computes the quality metrics for the `PredictionModel` using the specified dataset. It returns a object contains the overall metrics computed by regression evaluators. To display these to determine the quality of the model, you need to get the metrics first. Add the following code as the next line in the `Evaluate` method: -[!code-csharp[ComputeMetrics](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#16 "Compute Metrics")] +[!code-csharp[ComputeMetrics](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#17 "Compute Metrics")] Add the following code to evaluate the model and produce the evaluation metrics: @@ -269,15 +265,13 @@ Console.WriteLine($"* Model quality metrics evaluation "); Console.WriteLine($"*------------------------------------------------"); ``` -[!code-csharp[EvaluateAndMeasure](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#13 "Evaluate the model and its predictions.")] - [RSquared](../resources/glossary.md#coefficient-of-determination) is another evaluation metric of the regression models. RSquared takes values between 0 and 1. The closer its value is to 1, the better the model is. Add the following code into the `Evaluate` method to display the RSquared value: -[!code-csharp[DisplayRSquared](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#17 "Display the RSquared metric.")] +[!code-csharp[DisplayRSquared](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#18 "Display the RSquared metric.")] [RMS](../resources/glossary.md##root-of-mean-squared-error-rmse) is one of the evaluation metrics of the regression model. The lower it is, the better the model is. Add the following code into the `Evaluate` method to display the RMS value: -[!code-csharp[DisplayRMS](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#18 "Display the RMS metric.")] +[!code-csharp[DisplayRMS](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#19 "Display the RMS metric.")] ## Use the model for predictions @@ -302,27 +296,27 @@ The `TestSinglePrediction` method executes the following tasks: Add a call to the new method from the `Main` method, right under the `Evaluate` method call, using the following code: -[!code-csharp[CallTestSinglePrediction](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#16 "Call the TestSinglePrediction method")] +[!code-csharp[CallTestSinglePrediction](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#20 "Call the TestSinglePrediction method")] Since we want to load the model from the zip file we saved, we'll create the `FileStream` immediately before calling the `Load` method. Add the following code to the `TestSinglePrediction` method as the next line: -[!code-csharp[LoadTheModel](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#20 "Load the model")] +[!code-csharp[LoadTheModel](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#21 "Load the model")] While the `model` is a `transformer` that operates on many rows of data, a very common production scenario is a need for predictions on individual examples. The is a wrapper that is returned from the `MakePredictionFunction` method. Let's add the following code to create the `PredictionFunction` as the first line in the `Predict` Method: -[!code-csharp[MakePredictionFunction](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#21 "Create the PredictionFunction")] +[!code-csharp[MakePredictionFunction](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#22 "Create the PredictionFunction")] This tutorial uses one test trip within this class. Later you can add other scenarios to experiment with the model. Add a trip to test the trained model's prediction of cost in the `Predict` method by creating an instance of `TaxiTrip`: -[!code-csharp[PredictionData](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#22 "Create test data for single prediction")] +[!code-csharp[PredictionData](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#23 "Create test data for single prediction")] We can use that to predict the fare based on a single instance of the taxi trip data. To get a prediction, use on the data. Note that the input data is a string and the model includes the featurization. Your pipeline is in sync during training and prediction. You didn’t have to write preprocessing/featurization code specifically for predictions, and the same API takes care of both batch and one-time predictions. -[!code-csharp[Predict](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#23 "Create a prediction of taxi fare")] +[!code-csharp[Predict](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#24 "Create a prediction of taxi fare")] To display the predicted fare of the specified trip, add the following code into the `Main` method: -[!code-csharp[Predict](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#24 "Display the prediction.")] +[!code-csharp[Predict](../../../samples/machine-learning/tutorials/TaxiFarePrediction/Program.cs#25 "Display the prediction.")] Run the program to see the predicted taxi fare for your test case. @@ -344,4 +338,4 @@ In this tutorial, you learned how to: Advance to the next tutorial to learn more. > [!div class="nextstepaction"] -> [Iris clustering](iris-clustering.md) \ No newline at end of file +> [Iris clustering](iris-clustering.md) diff --git a/docs/standard/io/file-path-formats.md b/docs/standard/io/file-path-formats.md index f166431a6464e..7de3859e69f3c 100644 --- a/docs/standard/io/file-path-formats.md +++ b/docs/standard/io/file-path-formats.md @@ -6,6 +6,9 @@ helpviewer_keywords: - "I/O, long paths" - "long paths" - "path formats, Windows" +dev_langs: + - "csharp" + - "vb" author: "rpetrusha" ms.author: "ronpet" --- @@ -197,6 +200,11 @@ A peculiarity of the Windows file system that non-Windows users and developers f ```csharp Directory.Create("TeStDiReCtOrY"); ``` + +```vb +Directory.Create("TeStDiReCtOrY") +``` + creates a directory named TeStDiReCtOrY. If you rename a directory or file to change its case, the directory or file name reflects the case of the string used when you rename it. For example, the following code renames a file named test.txt to Test.txt: ```csharp @@ -211,7 +219,8 @@ class Example fi.MoveTo(@".\Test.txt"); } } -``` +``` + ```vb Imports System.IO diff --git a/docs/standard/microservices-architecture/docker-application-development-process/docker-app-development-workflow.md b/docs/standard/microservices-architecture/docker-application-development-process/docker-app-development-workflow.md index 424bfa13537ee..4c21a15da6d26 100644 --- a/docs/standard/microservices-architecture/docker-application-development-process/docker-app-development-workflow.md +++ b/docs/standard/microservices-architecture/docker-application-development-process/docker-app-development-workflow.md @@ -442,4 +442,4 @@ RUN powershell add-windowsfeature web-asp-net45 >[!div class="step-by-step"] [Previous](index.md) -[Next](../net-core-single-containers-linux-windows-server-hosts/index.md) \ No newline at end of file +[Next](../multi-container-microservice-net-applications/index.md) diff --git a/docs/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model.md b/docs/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model.md index 6d3a68917e4cd..aee3fbe0f52f2 100644 --- a/docs/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model.md +++ b/docs/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model.md @@ -7,7 +7,7 @@ ms.date: 10/08/2018 --- # Design a microservice domain model -*Define one rich domain model for each business microservice or Bounded Context * +*Define one rich domain model for each business microservice or Bounded Context.* Your goal is to create a single cohesive domain model for each business microservice or Bounded Context (BC). Keep in mind, however, that a BC or business microservice could sometimes be composed of several physical services that share a single domain model. The domain model must capture the rules, behavior, business language, and constraints of the single Bounded Context or business microservice that it represents. @@ -21,7 +21,7 @@ The same identity (that is, the same `Id` value, although perhaps not the same d For instance, the buyer entity might have most of a person’s attributes that are defined in the user entity in the profile or identity microservice, including the identity. But the buyer entity in the ordering microservice might have fewer attributes, because only certain buyer data is related to the order process. The context of each microservice or Bounded Context impacts its domain model. -*Domain entities must implement behavior in addition to implementing data attributes* +*Domain entities must implement behavior in addition to implementing data attributes.* A domain entity in DDD must implement the domain logic or behavior related to the entity data (the object accessed in memory). For example, as part of an order entity class you must have business logic and operations implemented as methods for tasks such as adding an order item, data validation, and total calculation. The entity’s methods take care of the invariants and rules of the entity instead of having those rules spread across the application layer. diff --git a/images/async/io-1.jpg b/images/async/io-1.jpg deleted file mode 100644 index 41e6e0edaaca2..0000000000000 Binary files a/images/async/io-1.jpg and /dev/null differ diff --git a/images/async/io-2.jpg b/images/async/io-2.jpg deleted file mode 100644 index 7a2c4acf1eec6..0000000000000 Binary files a/images/async/io-2.jpg and /dev/null differ diff --git a/images/async/ui.jpg b/images/async/ui.jpg deleted file mode 100644 index 55ebb403081f5..0000000000000 Binary files a/images/async/ui.jpg and /dev/null differ diff --git a/images/async/webserver-1.jpg b/images/async/webserver-1.jpg deleted file mode 100644 index 05d62bdefd98e..0000000000000 Binary files a/images/async/webserver-1.jpg and /dev/null differ diff --git a/images/async/webserver-2.jpg b/images/async/webserver-2.jpg deleted file mode 100644 index 4aff3c5c725b3..0000000000000 Binary files a/images/async/webserver-2.jpg and /dev/null differ