Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dae12a5
Update best-practices-for-system-net-classes.md to include TLS best p…
Mar 20, 2018
10e8c07
Update microservice-application-layer-web-api-design.md (#4708)
Mar 20, 2018
8aaf6cc
Update docker-app-development-workflow.md (#4711)
Mar 20, 2018
5fd1e73
Add default value to XmlWriterSettings.DoNotEscapeUriAttributes and f…
Mar 20, 2018
464e89a
Update index.md (#4699)
Mar 20, 2018
7fe06d6
Change check NotInheritedAttribute (#4668)
Mar 20, 2018
885ca9e
Fixed minor typo on sql statement. (#4695)
Mar 20, 2018
c87a1ee
fix innacurate descriptions (#4701)
Mar 20, 2018
3afc765
Add missing space (#4714)
Mar 20, 2018
1b86cf0
add ms.topic metadata value (#4717)
Mar 20, 2018
e2046f6
Update RunWorkerCompletedEventArgs.xml (#4548)
Mar 20, 2018
6510cd2
Change VB compiler switch from \ to - (#4632)
Mar 20, 2018
a68e92c
Fix MemoryCache syntax example (#4724)
Mar 21, 2018
dbed1a6
Added missing Introduction to C# spec TOC (#4725)
Mar 21, 2018
fa101b3
C13806: Potential extra character (#4715)
Mar 21, 2018
5ba9ae2
fix option name (#3624)
Mar 21, 2018
bb29cf2
Added include file for compiler options (#4726)
Mar 21, 2018
28cc5d1
SmtpClient doc correction for .net core. Fixes #4705 (#4706)
Mar 21, 2018
081e916
CI Update (#4689)
Mar 21, 2018
2ff4fce
fix link formatting (#4723)
Mar 21, 2018
54fcdc2
fix underscore formatting (#4720)
Mar 21, 2018
690b804
Fixed minor spelling error WFC -> WCF (#4734)
Mar 22, 2018
a18f4d8
Fixes minor typo `WFC` to `WCF` (#4735)
Mar 22, 2018
5741864
Update object-oriented-programming.md (#4737)
Mar 22, 2018
3c17cc1
Updates to Articles Concerning Ref Locals, In Parameters, and Readonl…
Mar 22, 2018
55b365d
Fixed minor typo (#4741)
Mar 22, 2018
059d81a
Update String.xml (#4739)
Mar 22, 2018
3f0fbd7
fix broken link + formatting (#4719)
Mar 22, 2018
9389308
update dotnet -i (#4703)
Mar 22, 2018
50e66ea
remove dead link (#4713)
Mar 22, 2018
d415fe1
Added two Visual Basic command-line switches (#4733)
Mar 22, 2018
a3710af
Updated Azure Cosmos DB branding and links (#4746)
Mar 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
"_vblang/spec/*.md": "language-reference"
},
"langs": {
"api/**.yml": ["csharp", "vb", "cpp", "fsharp"],
"api/System.Convert.yml": ["csharp", "vb", "cpp", "fsharp"]
"api/**.yml": ["csharp", "vb", "cpp"],
"api/System.Convert.yml": ["csharp", "vb", "cpp"]
},
"dev_langs": {
"docs/core/**/**.md": ["csharp"],
Expand Down
23 changes: 13 additions & 10 deletions docs/core/tools/dotnet-new.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
---
title: dotnet new command - .NET Core CLI
description: The dotnet new command creates new .NET Core projects based on the specified template.
keywords: dotnet-new, CLI, CLI command, .NET Core
author: mairaw
ms.author: mairaw
ms.date: 08/13/2017
ms.date: 03/21/2018
ms.topic: article
ms.prod: .net-core
ms.technology: dotnet-cli
ms.devlang: dotnet
ms.assetid: fcc3ed2e-9265-4d50-b59e-dc2e5c190b34
ms.workload:
- dotnetcore
---
Expand All @@ -23,7 +20,7 @@ ms.workload:

## Synopsis

# [.NET Core 2.x](#tab/netcore2x)
# [.NET Core 2.0](#tab/netcore2x)
```
dotnet new <TEMPLATE> [--force] [-i|--install] [-lang|--language] [-n|--name] [-o|--output] [-u|--uninstall] [Template options]
dotnet new <TEMPLATE> [-l|--list] [--type]
Expand All @@ -50,7 +47,7 @@ The command calls the [template engine](https://github.com/dotnet/templating) to

The template to instantiate when the command is invoked. Each template might have specific options you can pass. For more information, see [Template options](#template-options).

# [.NET Core 2.x](#tab/netcore2x)
# [.NET Core 2.0](#tab/netcore2x)

The command contains a default list of templates. Use `dotnet new -l` to obtain a list of the available templates. The following table shows the templates that come pre-installed with the .NET Core 2.0 SDK. The default language for the template is shown inside the brackets.

Expand Down Expand Up @@ -96,7 +93,7 @@ The command contains a default list of templates. Use `dotnet new -all` to obtai

## Options

# [.NET Core 2.x](#tab/netcore2x)
# [.NET Core 2.0](#tab/netcore2x)

`--force`

Expand All @@ -108,7 +105,9 @@ Prints out help for the command. It can be invoked for the `dotnet new` command

`-i|--install <PATH|NUGET_ID>`

Installs a source or template pack from the `PATH` or `NUGET_ID` provided. For information on creating custom templates, see [Custom templates for dotnet new](custom-templates.md).
Installs a source or template pack from the `PATH` or `NUGET_ID` provided. If you want to install a prerelease version of a template package, you need to specify the version in the format of `<package-name>::<package-version>`. By default, `dotnet new` passes \* for the version, which represents the last stable package version. See an example at the [Examples](#examples) section.

For information on creating custom templates, see [Custom templates for dotnet new](custom-templates.md).

`-l|--list`

Expand Down Expand Up @@ -170,11 +169,11 @@ Location to place the generated output. The default is the current directory.

Each project template may have additional options available. The core templates have the following additional options:

# [.NET Core 2.x](#tab/netcore2x)
# [.NET Core 2.0](#tab/netcore2x)

**console, angular, react, reactredux**

`--no-restore` - Doesn't perform an implicit restore during project creation.
`--no-restore` - Doesn't perform an implicit restore during project creation.

**classlib**

Expand Down Expand Up @@ -318,6 +317,10 @@ List all templates available for MVC:

`dotnet new mvc -l`

Install version 2.0 of the Single Page Application templates for ASP.NET Core (command option available for .NET Core SDK 1.1 and later versions only):

`dotnet new -i Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0`

## See also

[Custom templates for dotnet new](custom-templates.md)
Expand Down
16 changes: 9 additions & 7 deletions docs/core/tools/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: dotnet command - .NET Core CLI
description: Learn about the dotnet command (the generic driver for the .NET Core CLI tools) and its usage.
author: mairaw
ms.author: mairaw
ms.date: 11/28/2017
ms.date: 03/20/2018
ms.topic: article
ms.prod: .net-core
ms.technology: dotnet-cli
Expand All @@ -22,11 +22,13 @@ ms.workload:

# [.NET Core 2.x](#tab/netcore2x)
```
dotnet [command] [arguments] [--additional-deps] [--additionalprobingpath] [-d|--diagnostics] [--fx-version] [-h|--help] [--info] [--roll-forward-on-no-candidate-fx] [-v|--verbose] [--version]
dotnet [command] [arguments] [--additional-deps] [--additionalprobingpath] [-d|--diagnostics]
[--fx-version] [-h|--help] [--info] [--roll-forward-on-no-candidate-fx] [-v|--verbosity] [--version]
```
# [.NET Core 1.x](#tab/netcore1x)
```
dotnet [command] [arguments] [--additionalprobingpath] [-d|--diagnostics] [--fx-version] [-h|--help] [--info] [-v|--verbose] [--version]
dotnet [command] [arguments] [--additionalprobingpath] [-d|--diagnostics] [--fx-version]
[-h|--help] [--info] [-v|--verbosity] [--version]
```
---

Expand Down Expand Up @@ -70,9 +72,9 @@ Prints out detailed information about the CLI tooling and the environment, such

Rolls forward on no candidate shared framework.

`-v|--verbose`
`-v|--verbosity <LEVEL>`

Enables verbose output.
Sets the verbosity level of the command. Allowed values are `q[uiet]`, `m[inimal]`, `n[ormal]`, `d[etailed]`, and `diag[nostic]`. Not supported in every command; see specific command page to determine if this option is available.

`--version`

Expand Down Expand Up @@ -100,9 +102,9 @@ Prints out a short help for the command. If using with `dotnet`, it also prints

Prints out detailed information about the CLI tooling and the environment, such as the current operating system, commit SHA for the version, and other information.

`-v|--verbose`
`-v|--verbosity <LEVEL>`

Enables verbose output.
Sets the verbosity level of the command. Allowed values are `q[uiet]`, `m[inimal]`, `n[ormal]`, `d[etailed]`, and `diag[nostic]`. Not supported in every command; see specific command page to determine if this option is available.

`--version`

Expand Down
2 changes: 1 addition & 1 deletion docs/core/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The following tutorials are available for learning about .NET Core.
- [Testing a class library](testing-library-with-visual-studio.md)
- [Consuming a class library](consuming-library-with-visual-studio.md)
- [Building a complete C# .NET Core solution on Windows](using-on-windows-full-solution.md)
- [NoSQL tutorial: Build a DocumentDB C# console application on .NET Core](/azure/documentdb/documentdb-dotnetcore-get-started)
- [Azure Cosmos DB: Getting started with the SQL API and .NET Core](/azure/cosmos-db/sql-api-dotnetcore-get-started)

## Building applications with Visual Studio Code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ You can't use the `in`, `ref`, and `out` keywords for the following kinds of met

- Iterator methods, which include a [yield return](../../../csharp/language-reference/keywords/yield.md) or `yield break` statement.

You typically declare `in` arguments to avoid the copy operations necessary for passing arguments by value. This is most useful when arguments are structures or arrays of structures.
You typically declare `in` arguments to avoid the copy operations necessary for passing arguments by value. This is most useful when arguments are value types such as structures where copy operations are more expensive than passing by reference.

> [!WARNING]
> `in` parameters can be even more expensive if misused. The compiler may not know if member methods modify the state of the struct. Whenever the compiler cannot ensure that the object is not modified, it defensively creates a copy and calls member references using that copy. Any possible modifications are to that defensive copy. The two ways to avoid these copies are to pass `in` parameters as `in` arguments or to define structures as `readonly struct`.

## C# Language Specification
[!INCLUDE[CSharplangspec](~/includes/csharplangspec-md.md)]
Expand All @@ -65,4 +68,5 @@ You typically declare `in` arguments to avoid the copy operations necessary for
[C# Reference](../../../csharp/language-reference/index.md)
[C# Programming Guide](../../../csharp/programming-guide/index.md)
[C# Keywords](../../../csharp/language-reference/keywords/index.md)
[Method Parameters](../../../csharp/language-reference/keywords/method-parameters.md)
[Method Parameters](../../../csharp/language-reference/keywords/method-parameters.md)
[Reference Semantics with Value Types](../../../csharp/reference-semantics-with-value-types.md)
10 changes: 8 additions & 2 deletions docs/csharp/language-reference/keywords/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The `ref` keyword indicates a value that is passed by reference. It is used in t

- In a method signature, to return a value to the caller by reference. See [Reference return values](#reference-return-values) for more information.

- In a member body, to indicate that a reference return value is stored locally as a reference that the caller intends to modify. See [Ref locals](#ref-locals) for more information.
- In a member body, to indicate that a reference return value is stored locally as a reference that the caller intends to modify or, in general, a local variable accesses another value by reference. See [Ref locals](#ref-locals) for more information.

## Passing an argument by reference

Expand Down Expand Up @@ -104,7 +104,13 @@ For example, the following statement defines a ref local value that is returned
ref decimal estValue = ref Building.GetEstimatedValue();
```

Note that the `ref` keyword must be used in both places, or the compiler generates error CS8172, "Cannot initialize a by-reference variable with a value."
You can access a value by reference in the same way. In some cases, accessing a value by reference increases performance by avoiding a potentially expensive copy operation. For example, the following statement shows how one can define a ref local value that is used to reference a value.

```csharp
ref VeryLargeStruct reflocal = ref veryLargeStruct;
```

Note that in both examples the `ref` keyword must be used in both places, or the compiler generates error CS8172, "Cannot initialize a by-reference variable with a value."

## A ref returns and ref locals example

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# [C# 6.0 draft specification](index.md)
## [Introduction](../../../../_csharplang/spec/introduction.md)
## [Lexical structure](../../../../_csharplang/spec/lexical-structure.md)
## [Basic concepts](../../../../_csharplang/spec/basic-concepts.md)
## [Types](../../../../_csharplang/spec/types.md)
Expand Down
13 changes: 11 additions & 2 deletions docs/csharp/programming-guide/classes-and-structs/ref-returns.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ ref Person p = ref contacts.GetContactInformation("Brandie", "Best");

Subsequent usage of `p` is the same as using the variable returned by `GetContactInformation` because `p` is an alias for that variable. Changes to `p` also change the variable returned from `GetContactInformation`.

Note that the `ref` keyword is used both before the local variable declaration *and* before the method call. Failure to include both `ref` keywords in the variable declaration and assignment results in compiler error CS8172, "Cannot initialize a by-reference variable with a value."
Note that the `ref` keyword is used both before the local variable declaration *and* before the method call.

You can access a value by reference in the same way. In some cases, accessing a value by reference increases performance by avoiding a potentially expensive copy operation. For example, the following statement shows how one can define a ref local value that is used to reference a value.

```csharp
ref VeryLargeStruct reflocal = ref veryLargeStruct;
```

Note that the `ref` keyword is used both before the local variable declaration *and* before the value in the second example. Failure to include both `ref` keywords in the variable declaration and assignment in both examples results in compiler error CS8172, "Cannot initialize a by-reference variable with a value."

## Ref returns and ref locals: an example

Expand All @@ -96,4 +104,5 @@ Without support for reference return values, such an operation is usually perfor

## See also

[ref keyword](../../language-reference/keywords/ref.md)
[ref keyword](../../language-reference/keywords/ref.md)
[Reference Semantics with Value Types](../../../csharp/reference-semantics-with-value-types.md)
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct SampleStruct
To define a field:

```csharp
Class SampleClass
class SampleClass
{
public string sampleField;
}
Expand Down Expand Up @@ -379,7 +379,7 @@ class SampleClass : ISampleInterface
To define a generic class:

```csharp
Public class SampleGeneric<T>
public class SampleGeneric<T>
{
public T Field;
}
Expand Down
16 changes: 16 additions & 0 deletions docs/csharp/reference-semantics-with-value-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,22 @@ types.
These restrictions ensure that you do not accidentally use a `ref struct`
in a manner that could promote it to the managed heap.

## `readonly ref struct` type

Declaring a struct as `readonly ref` combines the benefits and restrictions of `ref struct` and `readonly struct` delcarations.

The following example demonstrates the declaration of `readonly ref struct`.

```csharp
readonly ref struct ReadOnlyRefPoint2D
{
public int X { get; }
public int Y { get; }

ReadOnlyRefPoint2D(int x, int y) => (X, Y) = (x, y);
}
```

## Conclusions

These enhancements to the C# language are designed for performance critical
Expand Down
26 changes: 13 additions & 13 deletions docs/framework/app-domains/how-to-build-a-single-file-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ A single-file assembly, which is the simplest type of assembly, contains type in

The following example creates an assembly named `myCode.exe` from a code module called `myCode`.

```csharp
```console
csc myCode.cs
```
```vb

```console
vbc myCode.vb
```

Expand All @@ -64,12 +64,12 @@ vbc myCode.vb

The following example creates an assembly named `myAssembly.exe` from a code module called `myCode`.

```csharp
csc /out:myAssembly.exe myCode.cs
```console
csc -out:myAssembly.exe myCode.cs
```

```vb
vbc /out:myAssembly.exe myCode.vb
```console
vbc -out:myAssembly.exe myCode.vb
```

## Creating Library Assemblies
Expand All @@ -79,18 +79,18 @@ vbc /out:myAssembly.exe myCode.vb

1. At the command prompt, type the following command:

\<*compiler command*> **/t:library** \<*module name*>
\<*compiler command*> **-t:library** \<*module name*>

In this command, *compiler command* is the compiler command for the language used in your code module, and *module name* is the name of the code module to compile into the assembly. You can also use other compiler options, such as the **/out:** option.
In this command, *compiler command* is the compiler command for the language used in your code module, and *module name* is the name of the code module to compile into the assembly. You can also use other compiler options, such as the **-out:** option.

The following example creates a library assembly named `myCodeAssembly.dll` from a code module called `myCode`.

```csharp
csc /out:myCodeLibrary.dll /t:library myCode.cs
```console
csc -out:myCodeLibrary.dll -t:library myCode.cs
```

```vb
vbc /out:myCodeLibrary.dll /t:library myCode.vb
```console
vbc -out:myCodeLibrary.dll -t:library myCode.vb
```

## See Also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ Defines an element that is used to configure a cache that is based on the <xref:
## Syntax

```xml
<memoryCache
<memoryCache>
<namedCaches>
<!-- child elements -->
</namedCaches>
< memoryCache />
</memoryCache>
```

## Type
Expand Down
Loading