-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DC8EA1DD-C8FF-4F33-8B9F-636FCD0C49A3}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>AlarmClock</RootNamespace> | ||
<AssemblyName>AlarmClock</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AlarmClock | ||
{ | ||
public delegate void TickHanlder(object sender, DateTime args); | ||
public delegate void AlarmHandler(object sender, DateTime args); | ||
public class Clock | ||
{ | ||
public event TickHanlder Tick; | ||
public event AlarmHandler Alarm; | ||
|
||
private DateTime time; | ||
private DateTime alarmtime; | ||
public DateTime Time { get => time; set => time = value; } | ||
public DateTime AlarmTime { get => alarmtime; set => alarmtime = value; } | ||
|
||
public Clock() | ||
{ | ||
time = DateTime.Now; | ||
} | ||
public void Begin() | ||
{ | ||
while (true) | ||
{ | ||
DateTime nowTime = DateTime.Now; | ||
Tick(this, nowTime); | ||
if (nowTime.ToString() == alarmtime.ToString()) | ||
{ | ||
Alarm(this, alarmtime); | ||
} | ||
System.Threading.Thread.Sleep(1000); | ||
} | ||
} | ||
|
||
} | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Clock c = new Clock(); | ||
c.Tick += ShowTick; | ||
c.Alarm += ShowAlarm; | ||
c.AlarmTime = c.Time.AddSeconds(10); | ||
c.Begin(); | ||
} | ||
static void ShowTick(object sender, DateTime time) | ||
{ | ||
Console.WriteLine("当前时间:" + time); | ||
} | ||
static void ShowAlarm(object sender, DateTime time) | ||
{ | ||
Console.WriteLine("闹钟时间:" + time); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 有关程序集的一般信息由以下 | ||
// 控制。更改这些特性值可修改 | ||
// 与程序集关联的信息。 | ||
[assembly: AssemblyTitle("AlarmClock")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("AlarmClock")] | ||
[assembly: AssemblyCopyright("Copyright © 2021")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 将 ComVisible 设置为 false 会使此程序集中的类型 | ||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 | ||
//请将此类型的 ComVisible 特性设置为 true。 | ||
[assembly: ComVisible(false)] | ||
|
||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | ||
[assembly: Guid("dc8ea1dd-c8ff-4f33-8b9f-636fcd0c49a3")] | ||
|
||
// 程序集的版本信息由下列四个值组成: | ||
// | ||
// 主版本 | ||
// 次版本 | ||
// 生成号 | ||
// 修订号 | ||
// | ||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 | ||
// 方法是按如下所示使用“*”: : | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
Binary file not shown.
1 change: 1 addition & 0 deletions
1
Homework4/AlarmClock/obj/Debug/AlarmClock.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dedb59040580e0943bf41ef0adddf9ad6e0ad287 |
7 changes: 7 additions & 0 deletions
7
Homework4/AlarmClock/obj/Debug/AlarmClock.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\bin\Debug\AlarmClock.exe.config | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\bin\Debug\AlarmClock.exe | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\bin\Debug\AlarmClock.pdb | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\obj\Debug\AlarmClock.csprojAssemblyReference.cache | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\obj\Debug\AlarmClock.csproj.CoreCompileInputs.cache | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\obj\Debug\AlarmClock.exe | ||
C:\Users\26419\source\repos\Homework4\AlarmClock\obj\Debug\AlarmClock.pdb |
Binary file added
BIN
+1.87 KB
Homework4/AlarmClock/obj/Debug/AlarmClock.csprojAssemblyReference.cache
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.61 KB
Homework4/AlarmClock/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{3F997190-87AD-4161-8A00-277252670AB2}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>ForEach</RootNamespace> | ||
<AssemblyName>ForEach</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ForEach | ||
{ | ||
public class Node<T> | ||
{ | ||
public Node<T> Next { get; set; } | ||
public T Data { set; get; } | ||
public Node(T t) | ||
{ | ||
Next = null; | ||
Data = t; | ||
} | ||
} | ||
public class GenericList<T> | ||
{ | ||
private Node<T> head; | ||
private Node<T> tail; | ||
|
||
public GenericList() | ||
{ | ||
tail = head = null; | ||
} | ||
public Node<T> Head | ||
{ | ||
get => head; | ||
} | ||
public void Add(T t) | ||
{ | ||
Node<T> n = new Node<T>(t); | ||
if (tail == null) | ||
{ | ||
head = tail = n; | ||
} | ||
else | ||
{ | ||
tail.Next = n; | ||
tail = n; | ||
} | ||
} | ||
public void ForEach(Action<T> action) | ||
{ | ||
for (Node<T> m = head; m.Next != null; m = m.Next) | ||
{ | ||
action(m.Data); | ||
} | ||
} | ||
} | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
GenericList<int> l = new GenericList<int>(); | ||
for (int i = 0; i < 10; i++) | ||
{ | ||
l.Add(i); | ||
} | ||
int sum = 0; | ||
int max = l.Head.Data; | ||
int min = l.Head.Data; | ||
|
||
l.ForEach(x => Console.WriteLine(x)); | ||
l.ForEach(x => sum += x); | ||
l.ForEach(x => { max = max > x ? max : x; }); | ||
l.ForEach(x => { min = min < x ? min : x; }); | ||
|
||
Console.WriteLine("最大值是:" + max); | ||
Console.WriteLine("最小值是:" + min); | ||
Console.WriteLine("总和是:" + sum); | ||
Console.ReadKey(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 有关程序集的一般信息由以下 | ||
// 控制。更改这些特性值可修改 | ||
// 与程序集关联的信息。 | ||
[assembly: AssemblyTitle("ForEach")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ForEach")] | ||
[assembly: AssemblyCopyright("Copyright © 2021")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 将 ComVisible 设置为 false 会使此程序集中的类型 | ||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 | ||
//请将此类型的 ComVisible 特性设置为 true。 | ||
[assembly: ComVisible(false)] | ||
|
||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | ||
[assembly: Guid("3f997190-87ad-4161-8a00-277252670ab2")] | ||
|
||
// 程序集的版本信息由下列四个值组成: | ||
// | ||
// 主版本 | ||
// 次版本 | ||
// 生成号 | ||
// 修订号 | ||
// | ||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 | ||
// 方法是按如下所示使用“*”: : | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
Binary file not shown.
Binary file added
BIN
+6.61 KB
Homework4/ForEach/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
1 change: 1 addition & 0 deletions
1
Homework4/ForEach/obj/Debug/ForEach.csproj.CoreCompileInputs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dedb59040580e0943bf41ef0adddf9ad6e0ad287 |
7 changes: 7 additions & 0 deletions
7
Homework4/ForEach/obj/Debug/ForEach.csproj.FileListAbsolute.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
C:\Users\26419\source\repos\Homework4\ForEach\obj\Debug\ForEach.csprojAssemblyReference.cache | ||
C:\Users\26419\source\repos\Homework4\ForEach\obj\Debug\ForEach.csproj.CoreCompileInputs.cache | ||
C:\Users\26419\source\repos\Homework4\ForEach\bin\Debug\ForEach.exe.config | ||
C:\Users\26419\source\repos\Homework4\ForEach\bin\Debug\ForEach.exe | ||
C:\Users\26419\source\repos\Homework4\ForEach\bin\Debug\ForEach.pdb | ||
C:\Users\26419\source\repos\Homework4\ForEach\obj\Debug\ForEach.exe | ||
C:\Users\26419\source\repos\Homework4\ForEach\obj\Debug\ForEach.pdb |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.