Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/core/extensions/logging-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ For more information, see the following resources:
- [Application Insights overview](/azure/application-insights/app-insights-overview)
- [ApplicationInsightsLoggerProvider for .NET Core ILogger logs](/azure/azure-monitor/app/ilogger) - Start here if you want to implement the logging provider without the rest of Application Insights telemetry.
- [Application Insights logging adapters](/azure/azure-monitor/app/asp-net-trace-logs).
- [Install, configure, and initialize the Application Insights SDK](/training/modules/instrument-web-app-code-with-application-insights) - Interactive tutorial on the Microsoft Learn site.
- [Learn how to use the tools offered in Application Insights to enhance the performance and stability of your applications](/training/modules/monitor-app-performance/).

## Logging provider design considerations

Expand Down
1 change: 0 additions & 1 deletion docs/core/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,5 @@ There are multiple variants of .NET, each supporting a different type of app. Th
## Next steps

* [Choose a .NET tutorial](tutorials/index.md)
* [Try .NET in your browser](../csharp/tour-of-csharp/tutorials/numbers-in-csharp.md)
* [Take a tour of C#](../csharp/tour-of-csharp/overview.md)
* [Take a tour of F#](../fsharp/tour.md)
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/attributes/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In the following example, `Conditional` is applied to a method to enable or disa

:::code language="csharp" source="snippets/trace.cs" :::

If the `TRACE_ON` identifier isn't defined, the trace output isn't displayed. Explore for yourself in the interactive window.
If the `TRACE_ON` identifier isn't defined, the trace output isn't displayed.

The `Conditional` attribute is often used with the `DEBUG` identifier to enable trace and logging features for debug builds but not in release builds, as shown in the following example:

Expand Down
26 changes: 13 additions & 13 deletions docs/csharp/language-reference/builtin-types/default-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
title: "Default values of built-in types"
description: "Learn the default values of C# types such as bool, char, int, float, double, and more."
ms.date: 11/18/2025
helpviewer_keywords:
helpviewer_keywords:
- "default [C#]"
- "parameterless constructor [C#]"
---
# Default values of C# types (C# reference)

The following table shows the default values of C# types:

|Type|Default value|
|---------|------------------|
|Any [reference type](../keywords/reference-types.md)|`null`|
|Any [built-in integral numeric type](integral-numeric-types.md)|0 (zero)|
|Any [built-in floating-point numeric type](floating-point-numeric-types.md)|0 (zero)|
|[bool](bool.md)|`false`|
|[char](char.md)|`'\0'` (U+0000)|
|[enum](enum.md)|The value produced by the expression `(E)0`, where `E` is the enum identifier.|
|[struct](struct.md)|The value produced by setting all value-type fields to their default values and all reference-type fields to `null`.|
|Any [nullable value type](nullable-value-types.md)|An instance for which the <xref:System.Nullable%601.HasValue%2A> property is `false` and the <xref:System.Nullable%601.Value%2A> property is undefined. That default value is also known as the *null* value of a nullable value type.|
| Type | Default value |
|-----------------------------------------------------------------------------|-----------------|
| Any [reference type](../keywords/reference-types.md) | `null` |
| Any [built-in integral numeric type](integral-numeric-types.md) | 0 (zero) |
| Any [built-in floating-point numeric type](floating-point-numeric-types.md) | 0 (zero) |
| [bool](bool.md) | `false` |
| [char](char.md) | `'\0'` (U+0000) |
| [enum](enum.md) | The value produced by the expression `(E)0`, where `E` is the enum identifier. |
| [struct](struct.md) | The value produced by setting all value-type fields to their default values and all reference-type fields to `null`. |
| Any [nullable value type](nullable-value-types.md) | An instance for which the <xref:System.Nullable%601.HasValue%2A> property is `false` and the <xref:System.Nullable%601.Value%2A> property is undefined. That default value is also known as the *null* value of a nullable value type. |

## Default value expressions

Expand All @@ -39,12 +39,12 @@ int a = default;

For a value type, the *implicit* parameterless constructor also produces the default value of the type, as the following example shows:

```csharp-interactive
```csharp
var n = new System.Numerics.Complex();
Console.WriteLine(n); // output: (0, 0)
```

At run time, if the <xref:System.Type?displayProperty=nameWithType> instance represents a value type, you can use the <xref:System.Activator.CreateInstance(System.Type)?displayProperty=nameWithType> method to invoke the parameterless constructor to obtain the default value of the type.
At runtime, if the <xref:System.Type?displayProperty=nameWithType> instance represents a value type, you can use the <xref:System.Activator.CreateInstance(System.Type)?displayProperty=nameWithType> method to invoke the parameterless constructor to obtain the default value of the type.

> [!NOTE]
> A [structure type](struct.md) (which is a value type) can have an [explicit parameterless constructor](struct.md#struct-initialization-and-default-values) that might produce a non-default value of the type. Thus, we recommend using the `default` operator or the `default` literal to produce the default value of a type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ The *floating-point numeric types* represent real numbers. All floating-point nu

C# supports the following predefined floating-point types:

|C# type/keyword|Approximate range|Precision|Size|.NET type|
|----------|-----------------------|---------------|--------------|--------------|
| C# type/keyword | Approximate range | Precision | Size | .NET type |
|-----------------|-------------------|-----------|------|-----------|
|`float`|±1.5 x 10<sup>−45</sup> to ±3.4 x 10<sup>38</sup>|~6-9 digits|4 bytes|<xref:System.Single?displayProperty=nameWithType>|
|`double`|±5.0 × 10<sup>−324</sup> to ±1.7 × 10<sup>308</sup>|~15-17 digits|8 bytes|<xref:System.Double?displayProperty=nameWithType>|
|`decimal`|±1.0 x 10<sup>-28</sup> to ±7.9228 x 10<sup>28</sup>|28-29 digits|16 bytes|<xref:System.Decimal?displayProperty=nameWithType>|
Expand All @@ -53,7 +53,7 @@ You can also mix integral types and the `decimal` type in an expression. In this

You cannot mix the `decimal` type with the `float` and `double` types in an expression. In this case, if you want to perform arithmetic, comparison, or equality operations, you must explicitly convert the operands either from or to the `decimal` type, as the following example shows:

```csharp-interactive
```csharp
double a = 1.0;
decimal b = 2.1m;
Console.WriteLine(a + (double)b);
Expand Down Expand Up @@ -88,7 +88,7 @@ The preceding example also shows the use of `_` as a *digit separator*. You can

You can also use scientific notation, that is, specify an exponent part of a real literal, as the following example shows:

```csharp-interactive
```csharp
double d = 0.42e2;
Console.WriteLine(d); // output 42

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ The `string` type represents a sequence of zero or more Unicode characters. `str

Although `string` is a reference type, the [equality operators `==` and `!=`](../operators/equality-operators.md#string-equality) are defined to compare the values of `string` objects, not references. Value based equality makes testing for string equality more intuitive. For example:

```csharp-interactive
```csharp
string a = "hello";
string b = "h";
// Append to contents of 'b'
// Append to contents of 'b'.
b += "ello";
Console.WriteLine(a == b);
Console.WriteLine(object.ReferenceEquals(a, b));
Expand Down Expand Up @@ -71,7 +71,7 @@ char x = str[2]; // x = 's';

In similar fashion, the `[]` operator can also be used for iterating over each character in a string:

```csharp-interactive
```csharp
string str = "test";

for (int i = 0; i < str.Length; i++)
Expand Down Expand Up @@ -155,7 +155,7 @@ Quoted string literals are enclosed in double quotation marks ("):

String literals can contain any character literal. Escape sequences are included. The following example uses escape sequence `\\` for backslash, `\u0066` for the letter f, and `\n` for newline.

```csharp-interactive
```csharp
string a = "\\\u0066\n F";
Console.WriteLine(a);
// Output:
Expand Down
22 changes: 11 additions & 11 deletions docs/csharp/language-reference/operators/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: "Operators and expressions - List all operators and expression"
description: "Learn the C# operators and expressions, operator precedence, and operator associativity."
ms.date: 11/28/2022
f1_keywords:
f1_keywords:
- "cs.operators"
helpviewer_keywords:
helpviewer_keywords:
- "operators [C#]"
- "operator precedence [C#]"
- "operator associativity [C#]"
Expand Down Expand Up @@ -54,14 +54,14 @@ You can use an [expression body definition](../../programming-guide/statements-e

In an expression with multiple operators, the operators with higher precedence are evaluated before the operators with lower precedence. In the following example, the multiplication is performed first because it has higher precedence than addition:

```csharp-interactive
```csharp
var a = 2 + 2 * 2;
Console.WriteLine(a); // output: 6
```

Use parentheses to change the order of evaluation imposed by operator precedence:

```csharp-interactive
```csharp
var a = (2 + 2) * 2;
Console.WriteLine(a); // output: 8
```
Expand Down Expand Up @@ -102,7 +102,7 @@ When operators have the same precedence, associativity of the operators determin

Use parentheses to change the order of evaluation imposed by operator associativity:

```csharp-interactive
```csharp
int a = 13 / 5 / 2;
int b = 13 / (5 / 2);
Console.WriteLine($"a = {a}, b = {b}"); // output: a = 1, b = 6
Expand All @@ -112,12 +112,12 @@ Console.WriteLine($"a = {a}, b = {b}"); // output: a = 1, b = 6

Unrelated to operator precedence and associativity, operands in an expression are evaluated from left to right. The following examples demonstrate the order in which operators and operands are evaluated:

| Expression | Order of evaluation |
| ---------- | ------------------- |
|`a + b`|a, b, +|
|`a + b * c`|a, b, c, *, +|
|`a / b + c * d`|a, b, /, c, d, *, +|
|`a / (b + c) * d`|a, b, c, +, /, d, *|
| Expression | Order of evaluation |
|-------------------|---------------------|
| `a + b` | a, b, + |
| `a + b * c` | a, b, c, *, + |
| `a / b + c * d` | a, b, /, c, d, *, + |
| `a / (b + c) * d` | a, b, c, +, /, d, * |

Typically, all operator operands are evaluated. However, some operators evaluate operands conditionally. That is, the value of the leftmost operand of such an operator defines if (or which) other operands should be evaluated. These operators are the conditional logical [AND (`&&`)](boolean-logical-operators.md#conditional-logical-and-operator-) and [OR (`||`)](boolean-logical-operators.md#conditional-logical-or-operator-) operators, the [null-coalescing operators `??` and `??=`](null-coalescing-operator.md), the [null-conditional operators `?.` and `?[]`](member-access-operators.md#null-conditional-operators--and-), and the [conditional operator `?:`](conditional-operator.md). For more information, see the description of each operator.

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/tokens/interpolated.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ For more information about custom formatting, see the [Custom formatting with IC

## Other resources

If you're new to string interpolation, see the [String interpolation in C#](../../tutorials/string-interpolation.md) interactive tutorial. That tutorial demonstrates how to use interpolated strings to produce formatted strings.
If you're new to string interpolation, see the [String interpolation in C#](../../tutorials/string-interpolation.md) tutorial. That tutorial demonstrates how to use interpolated strings to produce formatted strings.

## Compilation of interpolated strings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There are several steps to creating and validating your analyzer:

## Create the solution

- In Visual Studio, choose **File > New > Project...** to display the New Project dialog.
- In Visual Studio, choose **File > New > Project** to display the New Project dialog.
- Under **Visual C# > Extensibility**, choose **Analyzer with code fix (.NET Standard)**.
- Name your project "**MakeConst**" and click OK.

Expand Down
4 changes: 2 additions & 2 deletions docs/csharp/tour-of-csharp/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ C# is in the C family of languages. [C# syntax](../language-reference/keywords/i
The "Hello, World" program is traditionally used to introduce a programming language. Here it is in C#:

```csharp
// This line prints "Hello, World"
// This line prints "Hello, World"
Console.WriteLine("Hello, World");
```

The line starting with `//` is a *single line comment*. C# single line comments start with `//` and continue to the end of the current line. C# also supports *multi-line comments*. Multi-line comments start with `/*` and end with `*/`. The `WriteLine` method of the `Console` class, which is in the `System` namespace, produces the output of the program. This class is provided by the standard class libraries, which, by default, are automatically referenced in every C# program. Another program form requires you to declare the containing class and method for the program's entry point. The compiler synthesizes these elements when you use top-level statements.

This alternative format is still valid and contains many of the basic concepts in all C# programs. Many existing C# samples use the following equivalent format:

:::code language="csharp" interactive="try-dotnet" source="./snippets/shared/HelloWorld.cs":::
:::code language="csharp" source="./snippets/shared/HelloWorld.cs":::

The preceding "Hello, World" program starts with a `using` directive that references the `System` namespace. Namespaces provide a hierarchical means of organizing C# programs and libraries. Namespaces contain types and other namespaces—for example, the `System` namespace contains many types, such as the `Console` class referenced in the program, and many other namespaces, such as `IO` and `Collections`. A `using` directive that references a given namespace enables unqualified use of the types that are members of that namespace. Because of the `using` directive, the program can use `Console.WriteLine` as shorthand for `System.Console.WriteLine`. In the earlier example, that namespace was [implicitly](../language-reference/keywords/using-directive.md#the-global-modifier) included.

Expand Down
6 changes: 3 additions & 3 deletions docs/csharp/tour-of-csharp/tutorials/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Interactive tutorials
description: Learn C# in your browser, and get started with your own development environment
description: Learn C# using GitHub Codespaces, and get started with your own development environment.
ms.date: 12/10/2025
---
# Introduction to C\#
Expand All @@ -10,9 +10,9 @@ Welcome to the introduction to C# tutorials. These lessons start with interactiv
<!--markdownlint-disable-next-line MD034 -->
> [!VIDEO https://www.youtube.com/embed/9THmGiSPjBQ?si=3kUKFtOMLpEzeq7J]

The first lessons explain C# concepts by using small snippets of code. You learn the basics of C# syntax and how to work with data types like strings, numbers, and booleans. It's all interactive, and you'll be writing and running code within minutes. These first lessons assume no prior knowledge of programming or the C# language. Each lesson builds on the prior lessons. You should do them in order. However, if you have some programming experience, you can skip or skim the first lessons and start with any new concepts.
The first lessons explain C# concepts by using small snippets of code. You learn the basics of C# syntax and how to work with data types like strings, numbers, and Booleans. It's all interactive, and you'll be writing and running code within minutes. These first lessons assume no prior knowledge of programming or the C# language. Each lesson builds on the prior lessons. You should do them in order. However, if you have some programming experience, you can skip or skim the first lessons and start with any new concepts.

To use GitHub codespaces, you need to create a free [GitHub](https://github.com) account.
To use GitHub Codespaces, you need to create a free [GitHub](https://github.com) account.

## Hello world

Expand Down
6 changes: 2 additions & 4 deletions docs/csharp/tour-of-csharp/tutorials/numbers-in-csharp.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Work with Numbers - Introductory tutorial
description: This tutorial teaches you about the numeric types in C#. The tutorial contains a series of lessons that explore numbers and math operations in C#.
description: This tutorial teaches you about the numeric types in C#. The tutorial contains a series of lessons that explore numbers and math operations in C#.
ms.date: 12/10/2025
---
# Tutorial: How to use integer and floating point numbers in C\#
Expand Down Expand Up @@ -247,12 +247,10 @@ Now that you know the different numeric types, write code that calculates the ar

You should get an answer between 19 and 20.

When you try it, open the details pane to see how you did:

<!-- markdownlint-disable MD033 -->
<details>

:::code language="csharp" interactive="try-dotnet-method" source="./snippets/NumbersInCsharp/numbers.cs" id="Challenge":::
:::code language="csharp" source="./snippets/NumbersInCsharp/numbers.cs" id="Challenge":::
</details>
<!-- markdownlint-enable MD033 -->

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion docs/samples-and-tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ms.date: 02/01/2021

# .NET samples and tutorials

The .NET documentation contains a set of samples and tutorials that teach you about .NET. This article describes how to find, view, and download .NET, ASP.NET Core, and C# samples and tutorials. Find resources to learn the F# programming language on the [F# Foundation's site](https://fsharp.org/learn/). If you're interested in exploring C# using an online code editor, start with [this interactive tutorial](https://dotnet.microsoft.com/learn/dotnet/in-browser-tutorial/1) and continue with [C# interactive tutorial](../csharp/tour-of-csharp/tutorials/index.md). For instructions on how to view and download sample code, see the [Viewing and downloading samples](#view-and-download-samples) section.
The .NET documentation contains a set of samples and tutorials that teach you about .NET. This article describes how to find, view, and download .NET, ASP.NET Core, and C# samples and tutorials. Find resources to learn the F# programming language on the [F# Foundation's site](https://fsharp.org/learn/). If you're interested in exploring C#, start with [Hello World in 5 minutes](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro) and continue with [Introduction to C# tutorial](../csharp/tour-of-csharp/tutorials/index.md). For instructions on how to view and download sample code, see the [Viewing and downloading samples](#view-and-download-samples) section.

## .NET

Expand Down
Loading