Skip to content

Commit

Permalink
docs: tidied up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
andygjp committed Feb 24, 2019
1 parent 07977d1 commit 0b8baf4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void CheckingIfNamedProfileExists()
var profiles = launchSettings.GetProfiles();
var (exists, _) = profiles.Use("does-not-exist");
// Do something else if it doesn't exist
Console.WriteLine($"The profile does {(exists ? "" : "not")} exist.");
WriteOut.Line($"The profile does {(exists ? "" : "not")} exist.");
}

public static void UseNamedProfile()
Expand All @@ -47,7 +47,7 @@ public static void UseNamedProfile()
}
catch (NullReferenceException)
{
Console.WriteLine("The profile was null and it caused an exception!");
WriteOut.Line("The profile was null and it caused an exception!");
}
}

Expand All @@ -58,7 +58,7 @@ public static void Match()
profiles
.Use("does-not-exist")
.Match(
() => { Console.WriteLine($"The profile does not exist."); },
() => { WriteOut.Line("The profile does not exist."); },
WriteOut.EnvironmentalVariables);
}

Expand All @@ -70,7 +70,7 @@ public static void FunctionalMatch()
.Use("does-not-exist")
.Match(() => default,x => x);

Console.WriteLine($"The profile does {(profile is null ? "not" : "")} exist.");
WriteOut.Line($"The profile does {(profile is null ? "not" : "")} exist.");
}
}

Expand All @@ -82,14 +82,19 @@ public static void EnvironmentalVariables(Profile profile)
Console.Write($"The profile has {count} environment variables");
if (count is 0)
{
Console.WriteLine(".");
Line(".");
return;
}

foreach (var (key, value) in profile.EnvironmentVariables)
{
Console.WriteLine($"key={key}, value={value}");
Line($"key={key}, value={value}");
}
}

public static void Line(string message)
{
Console.WriteLine(message);
}
}
}

0 comments on commit 0b8baf4

Please sign in to comment.