main
syneffort 1 year ago
parent b113807b99
commit 690b0d05c6
  1. 25
      EffectiveCSharp/EffectiveCSharp.sln
  2. 10
      EffectiveCSharp/EffectiveCSharp/EffectiveCSharp.csproj
  3. 30
      EffectiveCSharp/EffectiveCSharp/LanguageComponent/CallEvent.cs
  4. 15
      EffectiveCSharp/EffectiveCSharp/Program.cs

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EffectiveCSharp", "EffectiveCSharp\EffectiveCSharp.csproj", "{1B79263C-F9E0-4FAC-8550-E91173EB3A2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1B79263C-F9E0-4FAC-8550-E91173EB3A2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B79263C-F9E0-4FAC-8550-E91173EB3A2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B79263C-F9E0-4FAC-8550-E91173EB3A2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B79263C-F9E0-4FAC-8550-E91173EB3A2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {18E619C9-0514-4336-A32F-36E7B1205A92}
EndGlobalSection
EndGlobal

@ -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>

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EffectiveCSharp.LanguageComponent
{
internal class CallEvent
{
public event EventHandler<string> Event;
public void Work()
{
int cnt = 0;
while (cnt < 10)
{
cnt++;
RaiseUpdate(cnt.ToString());
Thread.Sleep(1000);
}
}
private void RaiseUpdate(string contents)
{
Event?.Invoke(this, contents);
}
}
}

@ -0,0 +1,15 @@
using EffectiveCSharp.LanguageComponent;
namespace EffectiveCSharp
{
internal class Program
{
static void Main(string[] args)
{
CallEvent callEvent = new CallEvent();
callEvent.Event += (s, e) => Console.WriteLine(e);
callEvent.Work();
}
}
}
Loading…
Cancel
Save