mirror of
https://github.com/dotnet/intro-to-dotnet-web-dev.git
synced 2025-12-06 05:32:03 +01:00
Add feat: Debugging testing
This commit is contained in:
parent
a8f1f96a7c
commit
fc122d41a7
10
2-csharp/lesson-6-projects/Debug101/Debug101.csproj
Normal file
10
2-csharp/lesson-6-projects/Debug101/Debug101.csproj
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
34
2-csharp/lesson-6-projects/Debug101/Program.cs
Normal file
34
2-csharp/lesson-6-projects/Debug101/Program.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
This code uses a names array and corresponding methods to display
|
||||||
|
greeting messages
|
||||||
|
*/
|
||||||
|
|
||||||
|
string[] names = new string[] { "Sophia", "Andrew", "AllGreetings" };
|
||||||
|
|
||||||
|
string messageText = "";
|
||||||
|
|
||||||
|
foreach (string name in names)
|
||||||
|
{
|
||||||
|
if (name == "Sophia")
|
||||||
|
messageText = SophiaMessage();
|
||||||
|
else if (name == "Andrew")
|
||||||
|
messageText = AndrewMessage();
|
||||||
|
else if (name == "AllGreetings")
|
||||||
|
messageText = SophiaMessage();
|
||||||
|
messageText = messageText + "\n\r" + AndrewMessage();
|
||||||
|
|
||||||
|
Console.WriteLine(messageText + "\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool pauseCode = true;
|
||||||
|
while (pauseCode == true);
|
||||||
|
|
||||||
|
static string SophiaMessage()
|
||||||
|
{
|
||||||
|
return "Hello, my name is Sophia.";
|
||||||
|
}
|
||||||
|
|
||||||
|
static string AndrewMessage()
|
||||||
|
{
|
||||||
|
return "Hi, my name is Andrew. Good to meet you.";
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue