Skip to content

Commit ec685db

Browse files
authored
Full edit pass on day one content (#45376)
* Full edit pass on day one content Fixes #45112 * respond to feedback.
1 parent 23c0f85 commit ec685db

8 files changed

+75
-38
lines changed

docs/csharp/tour-of-csharp/overview.md

+34-20
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace TourOfCsharp
2+
{
3+
public class CollectionExpressions
4+
{
5+
public static void Examples()
6+
{
7+
// <CollectionExpressions>
8+
int[] numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
9+
List<string> names = ["Alice", "Bob", "Charlie", "David"];
10+
11+
IEnumerable<int> moreNumbers = [.. numbers, 11, 12, 13];
12+
IEnumerable<string> empty = [];
13+
// </CollectionExpressions>
14+
15+
// <RangeAndIndex>
16+
string second = names[1]; // 0-based index
17+
string last = names[^1]; // ^1 is the last element
18+
int[] smallNumbers = numbers[0..5]; // 0 to 4
19+
// </RangeAndIndex>
20+
}
21+
}
22+
}

docs/csharp/tour-of-csharp/snippets/shared/HelloWorld.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
using System;
1+
using System;
2+
using TourOfCsharp;
23

3-
class Hello
4+
class Program
45
{
56
static void Main()
67
{

docs/csharp/tour-of-csharp/snippets/shared/TourOfCsharp.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>true</ImplicitUsings>
88
</PropertyGroup>

docs/csharp/tour-of-csharp/strategy.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Language strategy
3-
description: We will keep evolving C# to meet the changing needs of developers and remain a state-of-the-art programming language. We will innovate eagerly and broadly in collaboration with C# developers
4-
ms.date: 02/06/2023
3+
description: We keep evolving C# to meet the changing needs of developers and remain a state-of-the-art programming language. We will innovate eagerly and broadly in collaboration with C# developers
4+
ms.date: 03/17/2025
55
ms.custom: UpdateFrequency5
66
---
77
# Annotated C# strategy
@@ -14,19 +14,19 @@ The C# strategy guides our decisions about C# evolution, and these annotations p
1414

1515
> "we will innovate eagerly and broadly"
1616
17-
The C# community continues to grow, and the C# language continues to evolve to meet the community's needs and expectations. We draw inspiration from a variety of sources to select features that benefit a large segment of C# developers, and that provide consistent improvements in productivity, readability, and performance.
17+
The C# community continues to grow, and the C# language continues to evolve to meet the community's needs and expectations. We draw inspiration from many sources to select features that benefit a large segment of C# developers, and that provide consistent improvements in productivity, readability, and performance.
1818

1919
> "being careful to stay within the spirit of the language"
2020
21-
We evaluate new ideas in the spirit and history of the C# language. We prioritize innovations that make sense to the majority of existing C# developers.
21+
We evaluate new ideas in the spirit and history of the C# language. We prioritize innovations that make sense to most existing C# developers.
2222

2323
> "improvements that benefit all or most developers"
2424
25-
Developers use C# in all .NET workloads, such as web front and back ends, cloud native development, desktop development and building cross platform applications. We focus on new features that have the most impact either directly, or by empowering improvements to common libraries. Language feature development includes integration into our developer tools and learning resources.
25+
Developers use C# in all .NET workloads. Developers build web front and back ends, cloud native apps, and desktop apps with C#. C# enables cross platform applications. We focus on new features that have the most impact either directly, or by empowering improvements to common libraries. Language feature development includes integration into our developer tools and learning resources.
2626

2727
> "high commitment to backwards compatibility"
2828
29-
We respect that there is a massive amount of C# code in use today. Any potential breaking change is carefully considered against the scale and impact of disruption to the C# community.
29+
We respect that there's a massive amount of C# code in use today. Any potential breaking change is carefully considered against the scale and impact of disruption to the C# community.
3030

3131
> "maintaining stewardship"
3232

docs/csharp/tour-of-csharp/tips-for-java-developers.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Tips for Java Developers
33
description: Are you new to C#, but experienced in Java? Here's a roadmap of what's familiar, and new features to learn in C#, and features in Java that aren't in C#.
4-
ms.date: 04/03/2024
4+
ms.date: 03/17/2025
55
---
66
# Roadmap for Java developers learning C\#
77

@@ -15,7 +15,7 @@ C# and Java have many similarities. As you learn C#, you can apply much of the k
1515
1. ***Standard libraries***: The .NET runtime and the Java Standard Library (JSL) have support for common tasks. Both have extensive ecosystems for other open source packages. In C#, the package manager is [NuGet](https://www.nuget.org). It's analogous to Maven.
1616
1. ***Garbage Collection***: Both languages employ automatic memory management through garbage collection. The runtime reclaims the memory from objects that aren't referenced. One difference is that C# enables you to create value types, as `struct` types.
1717

18-
You'll be productive in C# almost immediately because of the similarities. As you progress, you should learn features and idioms in C# that aren't available in Java:
18+
You can work productively in C# almost immediately because of the similarities. As you progress, you should learn features and idioms in C# that aren't available in Java:
1919

2020
1. [***Pattern matching***](../fundamentals/functional/pattern-matching.md): Pattern matching enables concise conditional statements and expressions based on the shape of complex data structures. The [`is` statement](../language-reference/operators/is.md) checks if a variable "is" some pattern. The pattern-based [`switch` expression](../language-reference/operators/switch-expression.md) provides a rich syntax to inspect a variable and make decisions based on its characteristics.
2121
1. [***String interpolation***](../language-reference/tokens/interpolated.md) and [***raw string literals***](../language-reference/builtin-types/reference-types.md#string-literals): String interpolation enables you to insert evaluated expressions in a string, rather than using positional identifiers. Raw string literals provide a way to minimize escape sequences in text.
@@ -24,7 +24,7 @@ You'll be productive in C# almost immediately because of the similarities. As yo
2424
1. [***LINQ***](../linq/index.md): Language integrated query (LINQ) provides a common syntax to query and transform data, regardless of its storage.
2525
1. [***Local functions***](../programming-guide/classes-and-structs/local-functions.md): In C#, you can nest functions inside methods, or other local functions. Local functions provide yet another layer of encapsulation.
2626

27-
There are other features in C# that aren't in Java. You'll see features like [`async` and `await`](../asynchronous-programming/index.md), and [`using`](../language-reference/statements/using.md) statements to automatically free nonmemory resources.
27+
There are other features in C# that aren't in Java. Features like [`async` and `await`](../asynchronous-programming/index.md) model asynchronous operations in sequential syntax. The [`using`](../language-reference/statements/using.md) statement automatically free nonmemory resources.
2828

2929
There are also some similar features between C# and Java that have subtle but important differences:
3030

@@ -38,4 +38,4 @@ Finally, there are Java language features that aren't available in C#:
3838
1. ***Checked exceptions***: In C#, any method could theoretically throw any exception.
3939
1. ***Checked array covariance***: In C#, arrays aren't safely covariant. You should use the generic collection classes and interfaces if you need covariant structures.
4040

41-
Overall, learning C# for a developer experienced in Java should be smooth. You'll find enough familiar idioms to quickly be productive, and you'll learn the new idioms quickly.
41+
Overall, learning C# for a developer experienced in Java should be smooth. C# has enough familiar idioms for you to be productive as you learn the new idioms.

docs/csharp/tour-of-csharp/tips-for-javascript-developers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Tips for JavaScript and TypeScript Developers
33
description: "New to C#, but know JavaScript or TypeScript? Here's a roadmap of what's familiar, features in C# that aren't in JavaScript or TypeScript, and alternatives for features you use that aren't in C#"
4-
ms.date: 04/03/2024
4+
ms.date: 03/17/2025
55
---
66
# Roadmap for JavaScript and TypeScript developers learning C\#
77

@@ -15,7 +15,7 @@ C#, TypeScript and JavaScript are all members of the C family of languages. The
1515
1. ***Event model***: C#'s [`event`](../events-overview.md) syntax is similar to JavaScript's model for document object model (DOM) events.
1616
1. ***Package manager***: [NuGet](https://nuget.org) is the most common package manager for C# and .NET, similar to npm for JavaScript applications. C# libraries are delivered in [assemblies](../../standard/assembly/index.md).
1717

18-
As you continue learning C#, you'll learn concepts that aren't part of JavaScript. Some of these concepts might be familiar to you if you use TypeScript:
18+
As you learn C#, you learn concepts that aren't part of JavaScript. Some of these concepts might be familiar to you if you use TypeScript:
1919

2020
1. [***C# Type System***](../fundamentals/types/index.md): C# is a strongly typed language. Every variable has a type, and that type can't change. You define `class` or `struct` types. You can define [`interface`](../fundamentals/types/interfaces.md) definitions that define behavior implemented by other types. TypeScript includes many of these concepts, but because TypeScript is built on JavaScript, the type system isn't as strict.
2121
1. [***Pattern matching***](../fundamentals/functional/pattern-matching.md): Pattern matching enables concise conditional statements and expressions based on the shape of complex data structures. The [`is` expression](../language-reference/operators/is.md) checks if a variable "is" some pattern. The pattern-based [`switch` expression](../language-reference/operators/switch-expression.md) provides a rich syntax to inspect a variable and make decisions based on its characteristics.
@@ -27,7 +27,7 @@ As you learn more other differences become apparent, but many of those differenc
2727

2828
Some familiar features and idioms from JavaScript and TypeScript aren't available in C#:
2929

30-
1. ***dynamic types***: C# uses static typing. A variable declaration includes the type, and that type can't change. There is a [`dynamic`](../language-reference/builtin-types/reference-types.md#the-dynamic-type) type in C# that provides runtime binding.
30+
1. ***dynamic types***: C# uses static typing. A variable declaration includes the type, and that type can't change. There's a [`dynamic`](../language-reference/builtin-types/reference-types.md#the-dynamic-type) type in C# that provides runtime binding.
3131
1. ***Prototypal inheritance***: C# inheritance is part of the type declaration. A C# `class` declaration states any base class. In JavaScript, you can set the `__proto__` property to set the base type on any instance.
3232
1. ***Interpreted language***: C# code must be compiled before you run it. JavaScript code can be run directly in the browser.
3333

docs/csharp/tour-of-csharp/tips-for-python-developers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Tips for Python Developers
33
description: New to C#, but know Python? Here's a roadmap of what's familiar, features in C# that aren't in Python, and alternatives for Python features that aren't in C#.
4-
ms.date: 04/03/2024
4+
ms.date: 03/17/2025
55
---
66
# Roadmap for Python developers learning C\#
77

@@ -15,7 +15,7 @@ C# and Python share similar concepts. These familiar constructs help you learn C
1515
1. ***Pattern matching***: Python's `match` expression and pattern matching is similar to C#'s [pattern matching](../fundamentals/functional/pattern-matching.md) `switch` expression. You use them to inspect a complex data expression to determine if it matches a pattern.
1616
1. ***Statement keywords***: Python and C# share many keywords, such as `if`, `else`, `while`, `for`, and many others. While not all syntax is the same, there's enough similarity that you can read C# if you know Python.
1717

18-
As you start learning C#, you'll learn these important concepts where C# is different than Python:
18+
As you learn C#, you discover these important concepts where C# is different than Python:
1919

2020
1. [***Indentation vs. tokens***](./tutorials/branches-and-loops.md): In Python, newlines and indentation are first-class syntactic elements. In C#, whitespace isn't significant. Tokens, like `;` separate statements, and other tokens `{` and `}` control block scope for `if` and other block statements. However, for readability, most coding styles (including the style used in these docs) use indentation to reinforce the block scopes declared by `{` and `}`.
2121
1. [***Static typing***](../fundamentals/types/index.md): In C#, a variable declaration includes its type. Reassigning a variable to an object of a different type generates a compiler error. In Python, the type can change when reassigned.

0 commit comments

Comments
 (0)