Initial commit
This commit is contained in:
commit
a04646840c
3 changed files with 40 additions and 0 deletions
16
FuncExt.sln
Normal file
16
FuncExt.sln
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FuncExt", "FuncExt\FuncExt.csproj", "{59855255-B71C-4C6D-8818-53D02D17EC19}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{59855255-B71C-4C6D-8818-53D02D17EC19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{59855255-B71C-4C6D-8818-53D02D17EC19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{59855255-B71C-4C6D-8818-53D02D17EC19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{59855255-B71C-4C6D-8818-53D02D17EC19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
14
FuncExt/Ext.cs
Normal file
14
FuncExt/Ext.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
namespace FuncExt;
|
||||||
|
|
||||||
|
public static class Pipe {
|
||||||
|
public static TRet Run<TRet, T>(this T obj, Func<T, TRet> action) =>
|
||||||
|
action(obj);
|
||||||
|
|
||||||
|
public static (T, TRet) Also<T, TRet>(this T obj, Func<T, TRet> action) =>
|
||||||
|
(obj, action(obj));
|
||||||
|
|
||||||
|
public static T Apply<T>(this T obj, Action<T> action) {
|
||||||
|
action(obj);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
10
FuncExt/FuncExt.csproj
Normal file
10
FuncExt/FuncExt.csproj
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue