docs
docs copied to clipboard
Add introduction to creating data types
Now, with C# 9, there are a number of different ways to create data types in C#:
- tuples
- records
- anonymous types
- classes
- structs
Tuples and records, in particular, are great concepts for beginners to learn to build data structures. They both should be introduced before classes.
Open question: Should structs and interfaces be part of this series, or in the fundamentals section?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 20c07a04-cf77-743d-6b4f-72b9122bdf45
- Version Independent ID: 525b2492-d227-fd0d-ea89-61cdfec3cd38
- Content: Introduction to C# - become familiar with the development tools
- Content Source: docs/csharp/tutorials/intro-to-csharp/local-environment.md
- Product: dotnet-csharp
- Technology: csharp-get-started
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn
I recommend covering interfaces only when classes are introduced, as that's when you're likely to introduce polymorphism. For a .NET dev to be successful with concepts like dependency injection in ASP.NET Core, an understanding of interfaces is essential. I also think it would be unfair to cover C# data types without mention of structs. Sure, they're not as commonly used as classes and interfaces, but it's all about using the right tool for the job.
Open question: Should structs and interfaces be part of this series, or in the fundamentals section?
As an introduction to creating data types, they should at least be called out as possible data types. Perhaps a table that outlines some common usages of the types, so that at a glance the consumer can see when it might make sense to create a specific type of object.
Moving this to December to update in the overall strategy of the fundamentals section.