Data Encoding in C#

Setting up Repository

Make a copy of this repository

Start by making a copy of this repository.

  1. Click the Use this template button on the main repository:

Use Template

  1. Name your repository XXXXXX-DataEncodingInCSharp, replacing the XXXXXX with your the first part of your email. (This is so I can easily find it later.)
  2. You may make your repository public or private.
  3. You do not need to include all of the branches

Create Repo

Add Mx. Collard as a Collaborator

For grading purposes, you need to add me to your repository so I can see your work.

  1. On the copied repository go to the settings tab

Settings

  1. On the settings page, select the Manage Access option on the left.

Manage Access

  1. On the manage access page, select Add people

Add People

  1. Search for jcollard and add me as a collaborator.

Add a Development Branch

With the exception of the group project, we have mostly been working on the main branch of our repositories. This is considered poor practice. The main branch is typically reserved for completed work on projects. A secondary branch called develop is typically created where you can work without fear of "polluting" the main branch.

  1. Using GitHub Desktop, Clone your new repository.
  2. Open your project in Visual Studio Code
  3. Use the command palette (Command + Shift + P) to run Git: Create Branch

Create Branch

  1. Name your branch develop

Develop Branch

Push your branch to GitHub

By default, a new branch is created locally on your computer (not published). To ensure your work is visible, you need to push your repository to GitHub.

  1. Use the command palette to run Git: Push

Git Push

  1. You will likely be prompted that your branch is not published. Select Okay to publish the branch.

Publish

Create a new C# Project

Let's start by creating a new C# project in this repository.

Before continuing, verify that you are on your develop branch. You can see which branch you are on by looking in the bottom left corner of Visual Studio Code.

Current Branch

  1. Clone your repository to your computer using GitHub Desktop
  2. Open the cloned repository in Visual Studio Code
  3. In Visual Studio Code, open a new Terminal
    • From the top menu select Terminal > New Terminal

New Terminal

  1. In the terminal, run the command dotnet new console
    • This creates a new template C# project.
    • If Visual Studio Code prompts you to generate missing files, select yes.

New Console

If all went well, you should now see several project files in your package explorer.

Project Files

  1. Open the Program.cs file. This file contains a simple "Hello World" program you can run.

Hello World

  1. Run the project by executing dotnet run in your terminal.

Run Hello

Create a Pull Request

Next, you will push your base project to GitHub and create a Pull Request that will allow Mx. Collard (and yourself) to see the changes that have been made to this project.

  1. Commit your work.
    • Your commit message should be something like chore: Initialize project
  2. Push your work
  3. In your web browser, visit your repository
  4. Select the Pull Request tab

Pull Request Tab

  1. Select the New Pull Request button

New PR

  1. Select that you would like to pull your develop into your main branch.

Develop

  1. Select Create Pull Request

Create PR

  1. Next add jcollard as a reviewer. (Note: This option will not be available until Mx. Collard accepts your invitation. You may need to skip this for now and add them later.)

Add Reviewer

  1. Finally, click Create Pull Request

Create PR