Skip to content

Commit 9141166

Browse files
authored
Merge pull request #557 from dotnet/master
Update live with current master
2 parents 7857258 + 102b49e commit 9141166

File tree

7 files changed

+3
-197
lines changed

7 files changed

+3
-197
lines changed

snippets/csharp/new-in-6/Enrollment.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

snippets/csharp/new-in-6/ExceptionFilterHelpers.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

snippets/csharp/new-in-6/NetworkClient.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,6 @@ public static async Task<string> MakeRequest()
2727
}
2828
// </ExceptionFilter>
2929

30-
// <HandleNotChanged>
31-
public static async Task<string> MakeRequestWithNotModifiedSupport()
32-
{
33-
var client = new System.Net.Http.HttpClient();
34-
var streamTask = client.GetStringAsync("https://localHost:10000");
35-
try {
36-
var responseText = await streamTask;
37-
return responseText;
38-
} catch (System.Net.Http.HttpRequestException e) when (e.Message.Contains("301"))
39-
{
40-
return "Site Moved";
41-
} catch (System.Net.Http.HttpRequestException e) when (e.Message.Contains("304"))
42-
{
43-
return "Use the Cache";
44-
}
45-
}
46-
// </HandleNotChanged>
47-
4830
// <AwaitFinally>
4931
public static async Task<string> MakeRequestAndLogFailures()
5032
{

snippets/csharp/new-in-6/Newcode.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ public Student(string firstName, string lastName)
3434
// <Initialization>
3535
public ICollection<double> Grades { get; } = new List<double>();
3636
// </Initialization>
37-
// <ReadWriteInitialization>
38-
public Standing YearInSchool { get; set; } = Standing.Freshman;
39-
// </ReadWriteInitialization>
4037

4138
// <FullNameExpressionMember>
4239
public string FullName => $"{FirstName} {LastName}";
@@ -46,35 +43,9 @@ public Student(string firstName, string lastName)
4643
public override string ToString() => $"{LastName}, {FirstName}";
4744
// </ToStringExpressionMember>
4845

49-
// <stringInterpolationExpression>
50-
public string GetFormattedGradePoint() =>
51-
$"Name: {LastName}, {FirstName}. G.P.A: {Grades.Average()}";
52-
// </stringInterpolationExpression>
53-
5446
// <stringInterpolationFormat>
5547
public string GetGradePointPercentage() =>
5648
$"Name: {LastName}, {FirstName}. G.P.A: {Grades.Average():F2}";
5749
// </stringInterpolationFormat>
58-
59-
// <stringInterpolationConditional>
60-
public string GetGradePointPercentages() =>
61-
$"Name: {LastName}, {FirstName}. G.P.A: {(Grades.Any() ? Grades.Average() : double.NaN):F2}";
62-
// </stringInterpolationConditional>
63-
64-
// <UsingStaticLinkMethod>
65-
public bool MakesDeansList()
66-
{
67-
return Grades.All(g => g > 3.5) && Grades.Any();
68-
// Code below generates CS0103:
69-
// The name 'All' does not exist in the current context.
70-
//return All(Grades, g => g > 3.5) && Grades.Any();
71-
}
72-
// </UsingStaticLinkMethod>
73-
74-
// <stringInterpolationLinq>
75-
public string GetAllGrades() =>
76-
$@"All Grades: {Grades.OrderByDescending(g => g)
77-
.Select(s => s.ToString("F2")).Aggregate((partial, element) => $"{partial}, {element}")}";
78-
// </stringInterpolationLinq>
7950
}
8051
}

snippets/csharp/new-in-6/Program.cs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Runtime.CompilerServices;
3-
using static NewStyle.ExceptionExtensions;
43

54
namespace NewInCSharp6
65
{
@@ -33,61 +32,8 @@ public static void Main(string[] args)
3332
test.Grades.Add(3.5);
3433
test.Grades.Add(1.0);
3534
test.Grades.Add(1.0);
36-
37-
Console.WriteLine(test.GetAllGrades());
3835
}
3936

40-
// <LogException>
41-
public void MethodThatFailsSometimes()
42-
{
43-
try {
44-
PerformFailingOperation();
45-
} catch (Exception e) when (e.LogException())
46-
{
47-
// This is never reached!
48-
}
49-
}
50-
// </LogException>
51-
52-
// <LogExceptionRecovery>
53-
public void MethodThatFailsButHasRecoveryPath()
54-
{
55-
try {
56-
PerformFailingOperation();
57-
} catch (Exception e) when (e.LogException())
58-
{
59-
// This is never reached!
60-
}
61-
catch (RecoverableException ex)
62-
{
63-
Console.WriteLine(ex.ToString());
64-
// This can still catch the more specific
65-
// exception because the exception filter
66-
// above always returns false.
67-
// Perform recovery here
68-
}
69-
}
70-
// </LogExceptionRecovery>
71-
72-
// <LogExceptionDebugger>
73-
public void MethodThatFailsWhenDebuggerIsNotAttached()
74-
{
75-
try {
76-
PerformFailingOperation();
77-
} catch (Exception e) when (e.LogException())
78-
{
79-
// This is never reached!
80-
}
81-
catch (RecoverableException ex) when (!System.Diagnostics.Debugger.IsAttached)
82-
{
83-
Console.WriteLine(ex.ToString());
84-
// Only catch exceptions when a debugger is not attached.
85-
// Otherwise, this should stop in the debugger.
86-
}
87-
}
88-
// </LogExceptionDebugger>
89-
90-
9137
private void PerformFailingOperation() {}
9238
}
9339

snippets/csharp/new-in-6/classList.cs

Lines changed: 0 additions & 54 deletions
This file was deleted.

wpf/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ If you're new to .NET Core, here are a few resources to help you understand the
1212
## Samples in this repo
1313
Coming soon!
1414

15+
## Additional Samples
16+
See [WPF Samples](https://www.github.com/Microsoft/wpf-samples) repo for additional WPF samples that have been updated to target .NET Core 3.0.
17+
1518
## Getting Started
1619

1720
### Prerequisites and getting the tools

0 commit comments

Comments
 (0)