The C# concept exercises are based on concepts. The list below contains the concepts that have been identified for the C# language.
The core OO features a C# developer should know about are:
- Classes ✅ (exercise
classes
) - Composition
- Encapsulation ✅ (exercise
classes
) - Fields ✅ (exercise
classes
) - Indexers
- Inheritance ✅ (exercise
inheritance
) - Interfaces 🚧 (issue #1225)
- Explicit Interface Implementation 🚧 (issue #1225)
- Methods ✅ (exercise
basics
)- Constructors ✅ (exercise
constructors
) - Destructors
- Extension methods 📖 (issue #1070)
- Method arguments 📖 (issue #1128)
- Named arguments 📖 (issue #1128)
- Out parameters 📖 (issue #1128)
- Optional arguments 📖 (issue #1128)
- Method overloading ✅ (exercise
method-overloading
) - Return values ✅ (exercise
basics
)
- Constructors ✅ (exercise
- Mutation ✅ (exercise
basics
) - Objects ✅ (exercise
classes
)- Object initializers
- Polymorphism ✅ (exercise
inheritance
) - Properties ✅ (exercise
properties
) - State ✅ (exercise
classes
) - Statics
- Structs 📖 (issue #1017)
While C# is primarily an OO language, lots of functional concepts have been added to the language:
- Expressions vs statements
- Expression-bodied members 📖 (issue #1145)
- Functions ✅ (exercise
basics
) - Immutability
- LINQ
- Advanced (GroupBy, Join, Zip, Cast, GroupJoin, AsEnumerable)
- Method Classification (deferred, non-streaming etc.)
- Query Syntax
- SelectMany
- Pattern matching
- Recursion
- Type inference ✅ (exercise
basics
)
- Asynchronous programming
- Attributes 📖 (issue #1176)
- Collections
- Collections: combining
- Collections: filtering
- Collections: mapping
- Collections: ordering
- Collections: reducing
- Iterators (yield)
- Async iterators
- Generics
- Constraints
- Covariance/Contravariance
- Comments ✅ (exercise
basics
) - Comparison
- Concurrency
- Concurrent collections
- Locks
- Conditionals
- Boolean logic ✅ (exercise
booleans
) - Conditionals: do-while
- Conditionals: switch
- Conditionals: while ✅ (exercise
floating-point-numbers
) - Conditionals: if ✅ (exercise [
conditionals
][exercise-conditionals]) - Conditionals: ternary
- Boolean logic ✅ (exercise
- Constants/readonly 📖 (issue #1044)
- Conversions
- Enumeration
- Exceptions 📖 (issue #966)
- User-defined exceptions 📖 (issue #1141)
- Null ✅ (exercise
nullability
)- Null-coalescing operator ✅ (exercise
nullability
) - Null-conditional operator ✅ (exercise
nullability
) - Null-forgiving operator ✅ (exercise
nullability
) - Nullable values ✅ (exercise
nullability
)
- Null-coalescing operator ✅ (exercise
- Numbers
- Arithmetic overflow 📖 (issue #1138)
- Bitwise manipulation ✅ (exercise
flag-enums
) - Math operators ✅ (exercise
numbers
)
- Randomness
- Reflection
- Regular expressions
- Resources
- Resource cleanup (
IDisposable
) - Resource lifetime
- Resource passing (by reference/by value)
- Resource allocation 📖 (issue #1018)
- Resource pooling 📖 (issue #1146)
- Resource cleanup (
- Scoping
- Slicing
- String formatting 📖 (issue #962)
- Unsafe code
- Variables ✅ (exercise
basics
)- Assignment ✅ (exercise
basics
) - Default values (a
bool
beingfalse
by default, etc.)
- Assignment ✅ (exercise
- Anonymous types
- Booleans ✅ (exercise
booleans
) - Characters 📖 (issue #960)
- Collections
- Arrays (exercise
arrays
) - Dictionaries ✅ (exercise
dictionaries
) - Enumerables
- Immutable collections
- Lists 📖 (issue #958)
- Queues
- Ranges
- Sets
- Stacks
- Arrays (exercise
- Dates ✅ (exercise
datetimes
)- Time zones
- Delegates
- Enums ✅ (exercise
enums
)- Flag enums ✅ (exercise
flag-enums
)
- Flag enums ✅ (exercise
- Events
- Indexes
- Lazy<T>
- Nested types
- Numbers ✅ (exercise
numbers
)- Floating point numbers ✅ (exercise
floating-point-numbers
) - Signed integers 📖 (issue #780)
- Unsigned integers 📖 (issue #780)
- Floating point numbers ✅ (exercise
- Pointers 📖 (issue #1147)
- Streams
- Strings ✅ (exercise
strings
) - Tasks
- Time
- Tuples 📖 (issue #963)
The concept exercises use the following concepts:
concept | interpretation |
---|---|
arrays |
Know of the existence of the Array type. Know how to define an array. Know how to access elements in an array by index. Know how to update an element in an array by index. Know how to iterate over elements in an array. Know of some basic functions (like finding the index of an element in an array). |
attributes |
Know what attributes are. Know how to annotate code with attributes. Know how to pass properties to attributes. |
basics |
Know what a variable is. Know how to define a variable. Know how to update a variable. Know how to use type inference for variables. Know how to define a method. Know how to return a value from a method. Know how to call a method. Know that methods must be defined in classes. Know about the public access modifier. Know about the static modifier. Know how to define an integer. Know how to use mathematical operators on integers. Know how to define single- and multiline comments. |
constructors |
Know what constructors are. Know how to define parameterless constructors. Know how to define parameterized constructors. Know how to use constructor overloading. Know how to define private constructors. |
bit-manipulation |
Know how to use bitwise operators to manipulate bits. |
booleans |
Know of the existence of the bool type and its two values. Know about boolean operators and how to build logical expressions with them. Know of the boolean operator precedence rules. |
classes |
Know what classes are. Know what encapsulation is. Know what fields are. Know how to create an object. Know how to update state through methods. Know about the void type. |
conditionals |
Know of the existence of the if conditional execution statement. |
custom-attributes |
Know of the existence of the Attribute type. Know what attributes are for. Know how to define custom attributes. Know how to read attribute values at runtime. Know how to limit attribute usage. |
datetimes |
Know of the existence of the DateTime type. Know how to create a DateTime instance. Know how to get the current date. Know of the individual, date- and time-related properties. Know how to access the current date. Know how to compare dates. Know how to convert a string to a DateTime and vice versa |
dictionaries |
Know of the existence of the Dictionary<TKey, TValue> type. Know how to create an instance. Know how to add and remove items, look up values, check for existence of keys and enumerate contents. |
enums |
Know of the existence of the enum keyword. Know how to define enum members. Know how to assign values to enum members. Know how to get an enum's numeric value. Know how to convert a string to an enum . |
flag-enums |
Know how to define a "flags" enum. Know how to add, remove or check for flags. Know how to change the underlying type of an enum. |
floating-point-numbers |
Know of the existing of the three floating point types: double , float and decimal . Know when to use which floating point type. |
for-loops |
Know how to use a for loop to do iteration. |
foreach-loops |
Know how to iterate over a collection using a foreach loop. |
indexers |
Know how to implement and use an indexer property. |
inheritance |
Know what inheritance is. Know how to inherit from a class. Know that all types inherit from object . Know what abstract and sealed classes are. Know what abstract and virtual methods are. Know how to override methods. Know about the protected visibility modifier. |
pattern-matching-constants |
Know how to use the switch statement to do constant pattern matching. |
method-overloading |
Know what method overloading is. Know how to define overloaded methods. Know the limitations of method overloading. |
named-arguments |
Know how to use named arguments. |
nullability |
Know of the existence of the null literal. Know what a NullReferenceException is and when it is thrown. Know how to compare a value to null . Know the difference between value and reference types regarding nullability, especially pre C# 8.0. Know how to define nullable reference and value types. Know about the null-related operators (! , ? , ?? ). Know about basic null checking by the compiler. |
numbers |
Know of the existence of the two most commonly used number types, int and double , and understand that the former represents whole numbers, and the latter floating-point numbers. Know of basic operators such as multiplication, comparison and equality. Know how to convert from one numeric type to another. Know what implicit and explicit conversions are. |
optional-parameters |
Know how to define optional parameters. |
properties |
Know what properties are and how they relate to fields and methods. Know what backing-field properties are. Know what auto-implemented properties are. Know what calculated properties are. Know how to use property accessors to customize visibility. Know how to define the different types of properties. |
strings |
Know of the existence of the string type. Know how to create a string. Know of some basic methods (like finding the index of a character in a string, or returning a part the string). Know how to do basic string formatting. |
while-loops |
Know how to write a while loop. |