Back to Freecodecamp

Create C# Methods with Parameters

curriculum/challenges/english/blocks/create-methods-in-c-sharp-console-applications/647e224b8acb466c97ccbeef.md

latest1.3 KB
Original Source

--description--

This challenge will be partially completed on the Microsoft Learn platform. Follow these instructions to complete the challenge:

  1. Go to <a href="https://learn.microsoft.com/training/modules/create-c-sharp-methods-parameters/" target="_blank" rel="noreferrer">https://learn.microsoft.com/training/modules/create-c-sharp-methods-parameters/</a> and complete all the tasks for the "Create C# Methods with Parameters" module. This is required to earn the "Create Methods in C# Console Applications" trophy on Microsoft Learn, and qualify for the certification exam.
  2. When you are finished, come back and correctly answer the question below.

--assignment--

Complete the <a href="https://learn.microsoft.com/training/modules/create-c-sharp-methods-parameters/" target="_blank" rel="noreferrer">Create C# Methods with Parameters</a> module on Microsoft Learn. Then, answer the question below.

--questions--

--text--

Given the method signature,

csharp
void Print(string name, string number = "", bool member = false)

Which of the following options correctly uses named and optional arguments?

--answers--

Print("Tony", member: true);


Print(number: "555", member: false)


Print("Tony", false)

--video-solution--

1