Skip to content

Commit 0046cf8

Browse files
remove warning for obsolete code showing interop
1 parent 5f6cdd6 commit 0046cf8

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# User-specific files (MonoDevelop/Xamarin Studio)
1414
*.userprefs
1515

16+
# Visual Code
17+
.vscode
18+
1619
# Mono auto generated files
1720
mono_crash.*
1821

1_CS/Tasks/AsyncSamples.sln

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
44
VisualStudioVersion = 17.0.31912.275
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4034038A-8C68-483D-9931-733C9079A9AF}"
7+
ProjectSection(SolutionItems) = preProject
8+
.editorconfig = .editorconfig
9+
EndProjectSection
710
EndProject
811
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErrorHandling", "ErrorHandling\ErrorHandling.csproj", "{2880F972-FE3D-489B-A141-37C1ACDBDDA7}"
912
EndProject

1_CS/Tasks/TaskFoundations/Program.cs

+4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ private static async void UseValueTask()
5656

5757
private static async void ConvertingAsyncPattern()
5858
{
59+
#pragma warning disable SYSLIB0014 // This method is used to demonstrate the old async pattern and convert it to the task-based async pattern
5960
HttpWebRequest? request = WebRequest.Create("http://www.microsoft.com") as HttpWebRequest;
61+
6062
if (request == null) return;
6163

6264
using WebResponse response = await Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse(null, null), request.EndGetResponse);
@@ -65,6 +67,8 @@ private static async void ConvertingAsyncPattern()
6567
using StreamReader reader = new(stream);
6668
string content = reader.ReadToEnd();
6769
Console.WriteLine(content.Substring(0, 100));
70+
71+
#pragma warning restore SYSLIB0014
6872
}
6973

7074
private static async void MultipleAsyncMethods()

0 commit comments

Comments
 (0)