Skip to content

Raywire/c-sharp-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

Description

These are some exercises to better understand programming concepts in C#

  1. Animal - Inheritance and polymorphism through method overriding.

  2. New vs Override - Shows what happens when you forget not include the override keyword. In order to do this intentionally and avoid the warning use the new keyword

    Without the override keyword

      mono ForgotOverride.exe

    Output

      Base
      Sub
      Base

    With the override keyword

    The Name property is not merely hidden it is overridden

      mono WithOverride.exe

    Output

      Base
      Sub
      Sub

    With intention not to use the override keyword use the new keyword

    Using the new keyword gives the same result as not including the override but gets rid of the warning . It is rarely used. Output

      Base
      Sub
      Base

Run the Animal folder

  • Change directory to the specific folder
  • Run the .exe file using mono C# compiler

For example

  cd Animal/
  mono Animal.exe

Run the Collections folder

  • Change directory to the Collections folder
  • Change directory to the specific folder
  • Run the .cs file using csharp command

For example

  cd Collections/JaggedArrays/
  csharp Cell.cs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages