Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions HomeWork15/HomeWork15/HomeWork15.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HomeWork15", "HomeWork15\HomeWork15.csproj", "{5607D0A7-5E1D-4025-9672-75C4F5D66C28}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5607D0A7-5E1D-4025-9672-75C4F5D66C28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5607D0A7-5E1D-4025-9672-75C4F5D66C28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5607D0A7-5E1D-4025-9672-75C4F5D66C28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5607D0A7-5E1D-4025-9672-75C4F5D66C28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67CAC64B-8CCD-4EF8-A684-E4AE24EDED14}
EndGlobalSection
EndGlobal
38 changes: 38 additions & 0 deletions HomeWork15/HomeWork15/HomeWork15/AsyncReader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace HomeWork15
{
internal class AsyncReader
{
private async static Task<string> ReadHelloAsync()
{
string text;

using (var readHello = new StreamReader("Hello.txt"))
{
text = await readHello.ReadToEndAsync();
}

return text;
}

private async static Task<string> ReadWordAsync()
{
string text;

using (var readHello = new StreamReader("Word.txt"))
{
text = await readHello.ReadToEndAsync();
}

return text;
}

public async static Task<string> ConcatinationHelloWordAsync()
{
var textHello = await ReadHelloAsync();

var textWord = await ReadWordAsync();

return string.Join(' ', textHello, textWord);
}
}
}
10 changes: 10 additions & 0 deletions HomeWork15/HomeWork15/HomeWork15/HomeWork15.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions HomeWork15/HomeWork15/HomeWork15/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace HomeWork15
{
internal class Program
{
async static Task Main(string[] args)
{
var task = Task.Run(() => AsyncReader.ConcatinationHelloWordAsync());

Console.WriteLine(task.Result);
}
}
}