-
Notifications
You must be signed in to change notification settings - Fork 6k
Add introduction to creating data types #22671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
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. |
Now, with C# 9, there are a number of different ways to create data types in C#:
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.
Associated WorkItem - 400547
The text was updated successfully, but these errors were encountered: