Open BillWagner opened 1 year ago
Areas outside of scope
The everyday C# section excludes many C# elements and techniques in order to focus on the most common techniques. This list explains why many areas of the language aren't covered in this section. (They are covered elsewhere in the C# guide.) The everyday C# section will link to the details on these sections for readers that want more depth on those techniques.
!!
, ?.
, ??=
, and is null
for as many as possible. All the everyday C# samples will have NRT enabled. Using if branches on null checks will be avoided.delegate
types, new delegate object won't be used. Instead, assign lambda expressions to Func
or Action
types.as
, casts: the pattern matching is expression is a better solution.static void Main()
. We want developers to see the new top-level statements feature in more tutorials. The equivalent syntax will be explained because of the history, abundance of code already using the traditional entry point, and some scenarios that require a user-declared entrypoint.static abstract
interface methodsref struct
, in arguments, readonly ref
: Fundamentals will consume them, but without explanation on the nuances of pass by reference, and readonly references.stackalloc
, unsafe
, fixed
. These aren't used in many common scenarios.dynamic
async
techniques other than Task
, async
and await
. This includes adding ConfigureAwait
to async calls.lock
: Fundamentals will avoid parallelism.volatile
.nint
, nuint
: These are specialized for native scenarios.goto
, continue
, break
(except in switch statements): These are less common, and can be confusing for beginners.Where do we find this curriculum at? Is this something you are working on or is it available now?
Hi @kennethversaw
It's not available yet. This is the proposed table of contents for a major update to the C# Guide that I'll be making over the next several months.
I published this issue to get feedback on the proposed topics.
What about a focus on testable coding? Functional-core-imperative-shell is a great structure. Another structure is the use of interfaces to enable lightweight tests which intercept things like I/O.
I got a question offline .
Topics like dependency injection or config handling. Are they out of scope because they aren't language features?
They won't be explicitly covered here because they aren't langauge features. However, the samples will use them because they are common practices in current application development. Where needed, the articles using them will link to articles that explain those library concepts.
Also, what about the required
keyword or raw string literals?
Also, what about the
required
keyword or raw string literals?
Yes to both.
What about a focus on testable coding? Functional-core-imperative-shell is a great structure. Another structure is the use of interfaces to enable lightweight tests which intercept things like I/O.
Good idea. I added a draft issue in this project to track this.
jpo ?
The following is an outline of the Everyday C# curriculum. It is not a complete syllabus. It has enough of an abstract for each section to begin writing that section.
string type
, and string interpolation.int
, anddouble
.List<T>
, andDictionary<K, V>
. Arrays will be limited to single-dimensional arrays. This module will include using index and range types to access elements and slices of collections. This will include loops to enumerate sequences (foreach
,while
,for
anddo
-while
).if
,else
,switch
)async
methods,await
ing method calls. This is an introduction to these features: Addingasync
on a method declaration, ensuring the return type isTask
,Task<T>
, and usingawait
whenever calling anasync
method. In addition, introduce async enumerables to enumerate asynchronous data sources.?.
,??=
andis not null
for null safety.with
expressions, discards, and deconstructionList<T>
andDictionary<K, V>
. In this unit, add more of scenarios where developers will use and create generic methods and types.