Skip to content

Modernized syntax, collection expressions and more explicitly typed variables #92

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Octanoz
Copy link

@Octanoz Octanoz commented Jul 29, 2025

Pretty much what the title says:

//original
var names = new List<string> { "Sophia", "Rob", "Michelle" };

//updated
List<string> names = [ "Sophia", "Rob", "Michelle" ];

//original
for (var i = 0; i < words.Length; i++)

//updated
for (int i = 0; i < words.Length; i++)

From notebook 10 onwards, in the C# 101 section, suddenly everything is instantiated with var. In my opinion, if you're going to do that, at least dedicate a section to explain the possibility to do that because it just seems to come out of nowhere and feels like a different person wrote those sections compared to the previous ones. I changed a few to explicitly typed where I thought it would be important for a beginner to know what they're looking at but I have left most as they were since it's a judgment call or style preference what is "correct" there.

…ions. Replaced var on some variables in favour of explicitly typed variable types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant