This issue describes how to implement the explicit-cast concept exercise for the C# track.
Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:
The goal of this exercise is to teach the student how to use time in C#.
Learning objectives
Know how to down cast in C#.
Know how to cast safely.
Understand that implicit casting is ubiquitous.
Know the difference between down casts using as and those using the old style C syntax.
Out of scope
Casting of primitive types (discussed under signed-integers).
Pattern matching (discussed under pattern-matching-types).
Concepts
explicit-casts with as keyword.
implicit-casts
Prerequisites
classes
inheritance
Other prerequisites will depend on the story.
Resources to refer to
Hints
This article describes how to use the as operator to down cast a reference type.
This article describes how to use the is operator as a guard when casting
After
This article describes how to use the as operator to down cast a reference type.
This article describes how to use the is operator as a guard when casting
This article describes use of the old C style cast expression.
Representer
This exercise does not require any specific representation logic to be added to the representer.
Analyzer
A check that the is guard is applied as appropriate can be checked by the analyzer.
This issue describes how to implement the
explicit-cast
concept exercise for the C# track.Getting started
Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:
Please also watch the following video:
Goal
The goal of this exercise is to teach the student how to use
time
in C#.Learning objectives
as
and those using the old style C syntax.Out of scope
pattern-matching-types
).Concepts
explicit-casts
withas
keyword.implicit-casts
Prerequisites
classes
inheritance
Other prerequisites will depend on the story.
Resources to refer to
Hints
This article describes how to use the
as
operator to down cast a reference type. This article describes how to use theis
operator as a guard when castingAfter
This article describes how to use the
as
operator to down cast a reference type. This article describes how to use theis
operator as a guard when casting This article describes use of the old C style cast expression.Representer
This exercise does not require any specific representation logic to be added to the representer.
Analyzer
A check that the
is
guard is applied as appropriate can be checked by the analyzer.Implementing
To implement this exercise, please follow these instructions.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.