Skip to content

Latest commit

 

History

History
259 lines (243 loc) · 25.8 KB

README.md

File metadata and controls

259 lines (243 loc) · 25.8 KB

C# reference

Concepts

The C# concept exercises are based on concepts. The list below contains the concepts that have been identified for the C# language.

Object-oriented

The core OO features a C# developer should know about are:

Functional

While C# is primarily an OO language, lots of functional concepts have been added to the language:

General

  • 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
  • Constants/readonly 📖 (issue #1044)
  • Conversions
    • Boxing/unboxing
    • Explicit (casts) 📖 (issue #1142)
    • Implicit 📖 (issue #1142)
  • Enumeration
  • Exceptions 📖 (issue #966)
    • User-defined exceptions 📖 (issue #1141)
  • Null ✅ (exercise nullability)
  • 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)
  • Scoping
    • Imports (usings)
    • Namespaces 📖 (issue #1127)
    • Visibility (public, private, etc.) ✅ (exercise classes)
  • Slicing
  • String formatting 📖 (issue #962)
    • Formatting types 📖 (issue #962)
    • Interpolation 📖 (issue #962)
    • StringBuilder 📖 (issue #962)
  • Unsafe code
  • Variables ✅ (exercise basics)
    • Assignment ✅ (exercise basics)
    • Default values (a bool being false by default, etc.)

Types

Concept interpretation

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.