Skip to content

Commit 9466adc

Browse files
authored
Add Action, Function and EventHandler (#116)
1 parent d1fdb44 commit 9466adc

File tree

9 files changed

+154
-6
lines changed

9 files changed

+154
-6
lines changed

nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@
2424
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
2525
<DocumentationFile>bin\$(Configuration)\mscorlib.xml</DocumentationFile>
2626
<Deterministic>true</Deterministic>
27+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
28+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
29+
<Deterministic>true</Deterministic>
30+
<IncludeSymbols>true</IncludeSymbols>
31+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2732
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">True</ContinuousIntegrationBuild>
2833
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
2934
</PropertyGroup>
3035
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3136
<DebugSymbols>true</DebugSymbols>
32-
<DebugType>full</DebugType>
37+
<DebugType>portable</DebugType>
3338
<Optimize>false</Optimize>
3439
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
3540
</PropertyGroup>
3641
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3742
<DebugSymbols>true</DebugSymbols>
38-
<DebugType>full</DebugType>
43+
<DebugType>portable</DebugType>
3944
<Optimize>true</Optimize>
4045
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
4146
</PropertyGroup>
@@ -60,6 +65,9 @@
6065
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
6166
<ItemGroup>
6267
<Compile Include="..\nanoFramework.CoreLibrary\Friends.cs" Link="Friends.cs" />
68+
<Compile Include="..\nanoFramework.CoreLibrary\System\Action.cs">
69+
<Link>System\Action.cs</Link>
70+
</Compile>
6371
<Compile Include="..\nanoFramework.CoreLibrary\System\AppDomain.cs" Link="System\AppDomain.cs" />
6472
<Compile Include="..\nanoFramework.CoreLibrary\System\AppDomainUnloadedException.cs" Link="System\AppDomainUnloadedException.cs" />
6573
<Compile Include="..\nanoFramework.CoreLibrary\System\ApplicationException.cs" Link="System\ApplicationException.cs" />
@@ -97,6 +105,12 @@
97105
<Compile Include="..\nanoFramework.CoreLibrary\System\Double.cs" Link="System\Double.cs" />
98106
<Compile Include="..\nanoFramework.CoreLibrary\System\Enum.cs" Link="System\Enum.cs" />
99107
<Compile Include="..\nanoFramework.CoreLibrary\System\Console.cs" Link="System\Console.cs" />
108+
<Compile Include="..\nanoFramework.CoreLibrary\System\EventArgs.cs">
109+
<Link>System\EventArgs.cs</Link>
110+
</Compile>
111+
<Compile Include="..\nanoFramework.CoreLibrary\System\EventHandler.cs">
112+
<Link>System\EventHandler.cs</Link>
113+
</Compile>
100114
<Compile Include="..\nanoFramework.CoreLibrary\System\Exception.cs" Link="System\Exception.cs" />
101115
<Compile Include="..\nanoFramework.CoreLibrary\System\FlagsAttribute.cs" Link="System\FlagsAttribute.cs" />
102116
<Compile Include="..\nanoFramework.CoreLibrary\System\GC.cs" Link="System\GC.cs" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<ItemGroup>
3+
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
4+
</ItemGroup>
5+
</Project>

nanoFramework.CoreLibrary/CoreLibrary.nfproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@
2424
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
2525
<DocumentationFile>bin\$(Configuration)\mscorlib.xml</DocumentationFile>
2626
<Deterministic>true</Deterministic>
27+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
28+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
29+
<Deterministic>true</Deterministic>
30+
<IncludeSymbols>true</IncludeSymbols>
31+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2732
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">True</ContinuousIntegrationBuild>
2833
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
2934
</PropertyGroup>
3035
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3136
<DebugSymbols>true</DebugSymbols>
32-
<DebugType>full</DebugType>
37+
<DebugType>portable</DebugType>
3338
<Optimize>false</Optimize>
3439
<DefineConstants>$(DefineConstants);NANOCLR_REFLECTION;DEBUG;TRACE</DefineConstants>
3540
</PropertyGroup>
3641
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3742
<DebugSymbols>true</DebugSymbols>
38-
<DebugType>full</DebugType>
43+
<DebugType>portable</DebugType>
3944
<Optimize>true</Optimize>
4045
<DefineConstants>$(DefineConstants);NANOCLR_REFLECTION;TRACE</DefineConstants>
4146
</PropertyGroup>
@@ -60,6 +65,7 @@
6065
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
6166
<ItemGroup>
6267
<Compile Include="Friends.cs" />
68+
<Compile Include="System\Action.cs" />
6369
<Compile Include="System\AppDomain.cs" />
6470
<Compile Include="System\AppDomainUnloadedException.cs" />
6571
<Compile Include="System\ApplicationException.cs" />
@@ -97,6 +103,8 @@
97103
<Compile Include="System\Double.cs" />
98104
<Compile Include="System\Enum.cs" />
99105
<Compile Include="System\Console.cs" />
106+
<Compile Include="System\EventArgs.cs" />
107+
<Compile Include="System\EventHandler.cs" />
100108
<Compile Include="System\Exception.cs" />
101109
<Compile Include="System\FlagsAttribute.cs" />
102110
<Compile Include="System\GC.cs" />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<ItemGroup>
3+
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
4+
</ItemGroup>
5+
</Project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
4+
// See LICENSE file in the project root for full license information.
5+
//
6+
7+
namespace System
8+
{
9+
using System.Runtime.CompilerServices;
10+
11+
/// <summary>
12+
/// Encapsulates a method that has no parameters and does not return a value.
13+
/// </summary>
14+
public delegate void Action();
15+
16+
/// <summary>
17+
/// Encapsulates a method that has a single parameter and does not return a value.
18+
/// </summary>
19+
/// <typeparam name="T">The type of the parameter of the method that this delegate encapsulates.
20+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
21+
/// <param name="obj">The parameter of the method that this delegate encapsulates.</param>
22+
public delegate void Action<in T>(T obj);
23+
24+
/// <summary>
25+
/// Encapsulates a method that has a single parameter and does not return a value.
26+
/// </summary>
27+
/// <typeparam name="T1">The type of the first parameter of the method that this delegate encapsulates.
28+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
29+
/// <typeparam name="T2">The type of the second parameter of the method that this delegate encapsulates.
30+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
31+
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
32+
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
33+
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
34+
35+
/// <summary>
36+
/// Encapsulates a method that has no parameters and returns a value of the type specified by the <typeparamref name="TResult"/> parameter.
37+
/// </summary>
38+
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.
39+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
40+
/// <returns>The return value of the method that this delegate encapsulates.</returns>
41+
public delegate TResult Func<out TResult>();
42+
43+
/// <summary>
44+
/// Encapsulates a method that has one parameter and returns a value of the type specified by the <typeparamref name="TResult"/> parameter.
45+
/// </summary>
46+
/// <typeparam name="T">The type of the parameter of the method that this delegate encapsulates.
47+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
48+
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.
49+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
50+
/// <param name="arg">The parameter of the method that this delegate encapsulates.</param>
51+
/// <returns>The return value of the method that this delegate encapsulates.</returns>
52+
public delegate TResult Func<in T, out TResult>(T arg);
53+
54+
/// <summary>
55+
/// Encapsulates a method that has one parameter and returns a value of the type specified by the <typeparamref name="TResult"/> parameter.
56+
/// </summary>
57+
/// <typeparam name="T1">The type of the parameter of the method that this delegate encapsulates.</typeparam>
58+
/// <typeparam name="T2">The type of the parameter of the method that this delegate encapsulates.</typeparam>
59+
/// <typeparam name="TResult">The type of the return value of the method that this delegate encapsulates.
60+
/// This type parameter is covariant.That is, you can use either the type you specified or any type that is more derived.For more information about covariance and contravariance, see <see href="https://docs.microsoft.com/en-us/dotnet/standard/generics/covariance-and-contravariance">Covariance and Contravariance in Generics</see>.</typeparam>
61+
/// <param name="arg1">The first parameter of the method that this delegate encapsulates.</param>
62+
/// <param name="arg2">The second parameter of the method that this delegate encapsulates.</param>
63+
/// <returns>The return value of the method that this delegate encapsulates.</returns>
64+
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
65+
}

nanoFramework.CoreLibrary/System/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
[assembly: AssemblyProduct("nanoFramework mscorlib")]
1515
[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")]
1616

17-
[assembly: AssemblyNativeVersion("100.5.0.2")]
17+
[assembly: AssemblyNativeVersion("100.5.0.3")]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
4+
// See LICENSE file in the project root for full license information.
5+
//
6+
7+
namespace System
8+
{
9+
/// <summary>
10+
/// Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.
11+
/// </summary>
12+
public class EventArgs
13+
{
14+
/// <summary>
15+
/// Provides a value to use with events that do not have event data.
16+
/// </summary>
17+
public static readonly EventArgs Empty = new EventArgs();
18+
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="EventArgs"/> class.
21+
/// </summary>
22+
public EventArgs()
23+
{
24+
}
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Copyright (c) .NET Foundation and Contributors
3+
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
4+
// See LICENSE file in the project root for full license information.
5+
//
6+
7+
namespace System
8+
{
9+
/// <summary>
10+
/// Represents the method that will handle an event that has no event data.
11+
/// </summary>
12+
/// <param name="sender">The source of the event.</param>
13+
/// <param name="e">An object that contains no event data.</param>
14+
public delegate void EventHandler(object sender, EventArgs e);
15+
16+
/// <summary>
17+
/// Represents the method that will handle an event when the event provides data.
18+
/// </summary>
19+
/// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
20+
/// <param name="sender">The source of the event.</param>
21+
/// <param name="e">An object that contains the event data.</param>
22+
#pragma warning disable S3246 // This is nanoFramework implementation of the EventHandler. It's meant to be this way.
23+
public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e);
24+
#pragma warning restore S3246 // Generic type parameters should be co/contravariant when possible
25+
}

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "1.9.1-preview.{height}",
3+
"version": "1.10.0-preview.{height}",
44
"assemblyVersion": {
55
"precision": "revision"
66
},

0 commit comments

Comments
 (0)