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
24 changes: 24 additions & 0 deletions .openpublishing.redirection.csharp.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@
"source_path_from_root": "/redirections/proposals/csharp-7.3/tuple-equality.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/expressions#121211-tuple-equality-operators"
},
{
"source_path_from_root": "/redirections/proposals/csharp-8.0/nullable-reference-types.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/redirections/proposals/csharp-9.0/nullable-reference-types-specification.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/redirections/proposals/csharp-10.0/generic-attributes.md",
"redirect_url": "/dotnet/csharp/language-reference/proposals/csharp-11.0/generic-attributes"
Expand Down Expand Up @@ -1378,6 +1386,22 @@
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-8.0/static-local-functions.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/statements.md#1364-local-function-declarations"
},
{
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-8.0/nullable-reference-types.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-9.0/nullable-reference-types-specification.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-9.0/nullable-constructor-analysis.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-9.0/nullable-parameter-default-value-analysis.md",
"redirect_url": "/dotnet/csharp/language-reference/language-specification/types.md#893-nullable-reference-types"
},
{
"source_path_from_root": "/docs/csharp/language-reference/proposals/csharp-9.0/index.md",
"redirect_url": "/dotnet/csharp/language-reference/proposals/csharp-9.0/records"
Expand Down
10 changes: 5 additions & 5 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
"csharp-8.0/shadowing-in-nested-functions.md",
"csharp-8.0/static-local-functions.md",
"csharp-8.0/unconstrained-null-coalescing.md",
"csharp-8.0/nullable-reference-types-specification.md"
"csharp-8.0/nullable-reference-types.md",
"csharp-8.0/nullable-reference-types-specification.md",
"csharp-9.0/nullable-reference-types-specification.md",
"csharp-9.0/nullable-constructor-analysis.md",
"csharp-9.0/nullable-parameter-default-value-analysis.md"
]
},
{
Expand Down Expand Up @@ -599,7 +603,6 @@
"_csharpstandard/standard/standard-library.md": "Standard library",
"_csharpstandard/standard/documentation-comments.md": "Documentation comments",
"_csharpstandard/standard/Bibliography.md": "Bibliography",
"_csharplang/proposals/csharp-8.0/nullable-reference-types.md": "Null reference types - proposal",
"_csharplang/proposals/csharp-8.0/patterns.md": "Recursive pattern matching",
"_csharplang/proposals/csharp-8.0/default-interface-methods.md": "Default interface methods",
"_csharplang/proposals/csharp-8.0/async-streams.md": "Async streams",
Expand All @@ -617,7 +620,6 @@
"_csharplang/proposals/csharp-9.0/local-function-attributes.md": "Attributes on local functions",
"_csharplang/proposals/csharp-9.0/module-initializers.md": "Module initializers",
"_csharplang/proposals/csharp-9.0/native-integers.md": "Native sized integers",
"_csharplang/proposals/csharp-9.0/nullable-reference-types-specification.md": "Nullable reference types - specification",
"_csharplang/proposals/csharp-9.0/patterns3.md": "Pattern matching changes",
"_csharplang/proposals/csharp-9.0/records.md": "Records",
"_csharplang/proposals/csharp-9.0/skip-localsinit.md": "Suppress emitting localsinit flag",
Expand Down Expand Up @@ -722,7 +724,6 @@
"_csharpstandard/standard/standard-library.md": "This appendix lists requirements of the specification library. The C# language relies on these types for some of its behavior.",
"_csharpstandard/standard/documentation-comments.md": "This appendix describes XML comments that are used to document your program.",
"_csharpstandard/standard/Bibliography.md": "This appendix lists external standards referenced in this specification.",
"_csharplang/proposals/csharp-8.0/nullable-reference-types.md": "This feature specification describes nullable reference types.",
"_csharplang/proposals/csharp-8.0/patterns.md": "This feature specification describes recursive pattern matching, where patterns can nest inside other patterns.",
"_csharplang/proposals/csharp-8.0/default-interface-methods.md": "This feature specification describe the syntax updates necessary to support default interface methods. This includes declaring bodies in interface declarations, and supporting modifiers on declarations.",
"_csharplang/proposals/csharp-8.0/async-streams.md": "This feature specification describes async streams, which return streams of data asynchronously, typically as each element is produced or available.",
Expand All @@ -740,7 +741,6 @@
"_csharplang/proposals/csharp-9.0/local-function-attributes.md": "This feature specification describes rules to apply attributes on local functions.",
"_csharplang/proposals/csharp-9.0/module-initializers.md": "This feature specification describes how to declare module initializers, which are methods called by the runtime when a module, or assembly, is loaded.",
"_csharplang/proposals/csharp-9.0/native-integers.md": "This feature specification describes native sized integers, which are integer types that use the processor's natural integral types.",
"_csharplang/proposals/csharp-9.0/nullable-reference-types-specification.md": "This feature specification provides a more complete specification for nullable reference types.",
"_csharplang/proposals/csharp-9.0/patterns3.md": "This feature specification describes the additional pattern matching syntax added in C# 9.0. This includes relational patterns, 'and' and 'or' patterns, negated patterns and parenthesized patterns.",
"_csharplang/proposals/csharp-9.0/records.md": "This feature specification describes records. Records are reference types that provide value based equality semantics.",
"_csharplang/proposals/csharp-9.0/skip-localsinit.md": "This feature specification describes a performance enhancement to suppress emitting localsinit flag. This will prevent the runtime from initializing memory to 0 as part of allocating it.",
Expand Down
4 changes: 2 additions & 2 deletions docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| Name | Package | Docs | Source |
| ---- | ------- | ---- | ------ |
| AI Foundry | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_1.0.0-beta.1/sdk/ai/Azure.AI.Projects/) |
| AI Model Inference | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.2/sdk/ai/Azure.AI.Inference/) |
| Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) |
| App Configuration | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.5.0) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.5.0/sdk/appconfiguration/Azure.Data.AppConfiguration/) |
Expand Down Expand Up @@ -365,7 +366,6 @@
| System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | |
| Unknown Display Name | NuGet [1.0.1-beta.3](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Image/1.0.1-beta.3) | | |
| Unknown Display Name | NuGet [1.0.0](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.0)<br>NuGet [1.0.1-beta.3](https://www.nuget.org/packages/Azure.AI.ContentSafety.Extension.Embedded.Text/1.0.1-beta.3) | | |
| Unknown Display Name | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects/1.0.0-beta.1) | | |
| Unknown Display Name | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.NUnit/1.0.0-beta.3) | | |
| Unknown Display Name | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Developer.MicrosoftPlaywrightTesting.TestLogger/1.0.0-beta.3) | | |
| Unknown Display Name | NuGet [1.0.4-preview](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.MySql/1.0.4-preview) | | |
Expand Down Expand Up @@ -475,7 +475,7 @@
| App Service - API Apps Service | NuGet [0.9.64](https://www.nuget.org/packages/Microsoft.Azure.AppService.ApiApps.Service/0.9.64) | | |
| Code Analyzers for Durable Functions | NuGet [0.5.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers/0.5.0) | | GitHub [0.5.0](https://github.com/Azure/azure-functions-durable-extension/tree/Analyzer-v0.3.0/src/WebJobs.Extensions.DurableTask.Analyzers) |
| Cosmos DB - BulkExecutor | NuGet [2.5.1-preview](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.BulkExecutor/2.5.1-preview) | | GitHub [2.5.1-preview](https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started) |
| Cosmos DB - Direct | NuGet [3.37.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.37.1) | | GitHub [3.37.1](https://github.com/Azure/azure-cosmos-dotnet-v3) |
| Cosmos DB - Direct | NuGet [3.37.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.37.2) | | GitHub [3.37.2](https://github.com/Azure/azure-cosmos-dotnet-v3) |
| Cosmos DB - Encryption | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.3)<br>NuGet [2.1.0-preview4](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.1.0-preview4) | | GitHub [2.0.3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) |
| Cosmos DB - Encryption | NuGet [1.0.0-preview07](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview07) | | |
| Extensions - Caching Cosmos | NuGet [1.7.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Cosmos/1.7.0) | | GitHub [1.7.0](https://github.com/Azure/Microsoft.Extensions.Caching.Cosmos/tree/v1.0.0-preview4) |
Expand Down
1 change: 1 addition & 0 deletions docs/azure/includes/dotnet-new.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| Name | Package | Docs | Source |
| ---- | ------- | ---- | ------ |
| AI Foundry | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.AI.Projects/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/AI.Projects-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Projects_1.0.0-beta.1/sdk/ai/Azure.AI.Projects/) |
| AI Model Inference | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Inference/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Inference-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Inference_1.0.0-beta.2/sdk/ai/Azure.AI.Inference/) |
| Anomaly Detector | NuGet [3.0.0-preview.7](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.7) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [3.0.0-preview.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.7/sdk/anomalydetector/Azure.AI.AnomalyDetector/) |
| App Configuration | NuGet [1.5.0](https://www.nuget.org/packages/Azure.Data.AppConfiguration/1.5.0) | [docs](/dotnet/api/overview/azure/Data.AppConfiguration-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.5.0/sdk/appconfiguration/Azure.Data.AppConfiguration/) |
Expand Down
82 changes: 32 additions & 50 deletions docs/csharp/fundamentals/types/snippets/generics/Program.cs
Original file line number Diff line number Diff line change
@@ -1,86 +1,66 @@
namespace generics
namespace generics
{
//---------------------------------------------------------------------------
//<Snippet1>
// Declare the generic class.
public class GenericList<T>
{
public void Add(T input) { }
public void Add(T item) { }
}

public class ExampleClass { }

class TestGenericList
{
private class ExampleClass { }
static void Main()
{
// Declare a list of type int.
GenericList<int> list1 = new GenericList<int>();
// Create a list of type int.
GenericList<int> list1 = new();
list1.Add(1);

// Declare a list of type string.
GenericList<string> list2 = new GenericList<string>();
// Create a list of type string.
GenericList<string> list2 = new();
list2.Add("");

// Declare a list of type ExampleClass.
GenericList<ExampleClass> list3 = new GenericList<ExampleClass>();
// Create a list of type ExampleClass.
GenericList<ExampleClass> list3 = new();
list3.Add(new ExampleClass());
}
}
//</Snippet1>
namespace SecondExample
{
//<Snippet2>
// type parameter T in angle brackets
// Type parameter T in angle brackets.
public class GenericList<T>
{
// The nested class is also generic on T.
private class Node
// The nested class is also generic, and
// holds a data item of type T.
private class Node(T t)
{
// T used in non-generic constructor.
public Node(T t)
{
next = null;
data = t;
}

private Node? next;
public Node? Next
{
get { return next; }
set { next = value; }
}

// T as private member data type.
private T data;
// T as property type.
public T Data { get; set; } = t;

// T as return type of property.
public T Data
{
get { return data; }
set { data = value; }
}
public Node? Next { get; set; }
}

// First item in the linked list
private Node? head;

// constructor
public GenericList()
{
head = null;
}

// T as method parameter type:
// T as parameter type.
public void AddHead(T t)
{
Node n = new Node(t);
Node n = new(t);
n.Next = head;
head = n;
}

// T in method return type.
public IEnumerator<T> GetEnumerator()
{
Node? current = head;

while (current != null)
while (current is not null)
{
yield return current.Data;
current = current.Next;
Expand All @@ -92,27 +72,29 @@ public IEnumerator<T> GetEnumerator()
namespace ThirdExample
{
using SecondExample;
//<Snippet3>
class TestGenericList
{
static void Main()
{
// int is the type argument
GenericList<int> list = new GenericList<int>();
//<Snippet3>
// A generic list of int.
GenericList<int> list = new();

// Add ten int values.
for (int x = 0; x < 10; x++)
{
list.AddHead(x);
}

// Write them to the console.
foreach (int i in list)
{
System.Console.Write(i + " ");
Console.WriteLine(i);
}
System.Console.WriteLine("\nDone");

Console.WriteLine("Done");
//</Snippet3>
}
}
//</Snippet3>
}

}
3 changes: 1 addition & 2 deletions docs/csharp/nullable-references.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ In the preceding example, the declaration of the array shows it holds non-nullab

## See also

- [Nullable reference types proposal](~/_csharplang/proposals/csharp-8.0/nullable-reference-types.md)
- [Draft nullable reference types specification](~/_csharplang/proposals/csharp-9.0/nullable-reference-types-specification.md)
- [Nullable reference types specification](~/_csharpstandard/standard/types.md#893-nullable-reference-types)
- [Unconstrained type parameter annotations](~/_csharplang/proposals/csharp-9.0/unconstrained-type-parameter-annotations.md)
- [Intro to nullable references tutorial](tutorials/nullable-reference-types.md)
- [**Nullable** (C# Compiler option)](language-reference/compiler-options/language.md#nullable)
Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/specification/feature-spec-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ms.date: 05/08/2024
---
# Feature specifications

Because the [C# standard specification](overview.md) has fallen behind the latest C# implementation, this section contains the [Microsoft specifications](~/_csharplang/proposals/csharp-8.0/nullable-reference-types.md) for those newer features that haven't yet been incorporated into the standard. You can read these specifications to get information on newer features.
Because the [C# standard specification](overview.md) has fallen behind the latest C# implementation, this section contains the [Microsoft specifications](~/_csharplang/proposals/csharp-10.0/enhanced-line-directives.md) for those newer features that haven't yet been incorporated into the standard. You can read these specifications to get information on newer features.

The feature specifications began as proposals for the design. They include proposed changes to the standard. The C# language design team and compiler team produce these feature specifications. The purpose of the proposals is to guide the design and implementation of the feature. They might include proposed features that haven't yet been implemented. The actual implementation might have modified behavior. Those changes are captured in the language design meeting (LDM) notes. The LDM notes are the minutes of the language design meetings. In most cases, the pertinent LDM notes are linked from the feature specifications.

Expand Down
Loading
Loading