Skip to content

Commit

Permalink
Improve and add more value delegates functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
laicasaane committed Feb 20, 2021
1 parent 3bae914 commit 0043e9c
Show file tree
Hide file tree
Showing 28 changed files with 2,163 additions and 138 deletions.
37 changes: 31 additions & 6 deletions System.Delegates/Action/IAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,58 @@ public interface IAction
void Invoke();
}

public interface IAction<TClosure>
public interface IAction<in TClosure>
{
void Invoke(TClosure closure);
}

public interface IAction<TClosure, T> : IAction<TClosure>
public interface IAction<in TClosure, in T> : IAction<TClosure>
{
void SetArguments(T arg);
}

public interface IAction<TClosure, T1, T2> : IAction<TClosure>
public interface IAction<in TClosure, in T1, in T2> : IAction<TClosure>
{
void SetArguments(T1 arg1, T2 arg2);
}

public interface IAction<TClosure, T1, T2, T3> : IAction<TClosure>
public interface IAction<in TClosure, in T1, in T2, in T3> : IAction<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3);
}

public interface IAction<TClosure, T1, T2, T3, T4> : IAction<TClosure>
public interface IAction<in TClosure, in T1, in T2, in T3, in T4> : IAction<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}

public interface IAction<TClosure, T1, T2, T3, T4, T5> : IAction<TClosure>
public interface IAction<in TClosure, in T1, in T2, in T3, in T4, in T5> : IAction<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IActionArgIn<in TClosure, T> : IAction<TClosure>
{
void SetArguments(in T arg);
}

public interface IActionArgIn<in TClosure, T1, T2> : IAction<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IActionArgIn<in TClosure, T1, T2, T3> : IAction<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IActionArgIn<in TClosure, T1, T2, T3, T4> : IAction<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IActionArgIn<in TClosure, T1, T2, T3, T4, T5> : IAction<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
35 changes: 30 additions & 5 deletions System.Delegates/Action/IActionIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,53 @@ public interface IActionIn<TClosure>
void Invoke(in TClosure closure);
}

public interface IActionIn<TClosure, T> : IActionIn<TClosure>
public interface IActionIn<TClosure, in T> : IActionIn<TClosure>
{
void SetArguments(T arg);
}

public interface IActionIn<TClosure, T1, T2> : IActionIn<TClosure>
public interface IActionIn<TClosure, in T1, in T2> : IActionIn<TClosure>
{
void SetArguments(T1 arg1, T2 arg2);
}

public interface IActionIn<TClosure, T1, T2, T3> : IActionIn<TClosure>
public interface IActionIn<TClosure, in T1, in T2, in T3> : IActionIn<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3);
}

public interface IActionIn<TClosure, T1, T2, T3, T4> : IActionIn<TClosure>
public interface IActionIn<TClosure, in T1, in T2, in T3, in T4> : IActionIn<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}

public interface IActionIn<TClosure, T1, T2, T3, T4, T5> : IActionIn<TClosure>
public interface IActionIn<TClosure, in T1, in T2, in T3, in T4, in T5> : IActionIn<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IActionInArgIn<TClosure, T> : IActionIn<TClosure>
{
void SetArguments(in T arg);
}

public interface IActionInArgIn<TClosure, T1, T2> : IActionIn<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IActionInArgIn<TClosure, T1, T2, T3> : IActionIn<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IActionInArgIn<TClosure, T1, T2, T3, T4> : IActionIn<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IActionInArgIn<TClosure, T1, T2, T3, T4, T5> : IActionIn<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
35 changes: 30 additions & 5 deletions System.Delegates/Action/IActionRef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,53 @@ public interface IActionRef<TClosure>
void Invoke(ref TClosure closure);
}

public interface IActionRef<TClosure, T> : IActionRef<TClosure>
public interface IActionRef<TClosure, in T> : IActionRef<TClosure>
{
void SetArguments(T arg);
}

public interface IActionRef<TClosure, T1, T2> : IActionRef<TClosure>
public interface IActionRef<TClosure, in T1, in T2> : IActionRef<TClosure>
{
void SetArguments(T1 arg1, T2 arg2);
}

public interface IActionRef<TClosure, T1, T2, T3> : IActionRef<TClosure>
public interface IActionRef<TClosure, in T1, in T2, in T3> : IActionRef<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3);
}

public interface IActionRef<TClosure, T1, T2, T3, T4> : IActionRef<TClosure>
public interface IActionRef<TClosure, in T1, in T2, in T3, in T4> : IActionRef<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}

public interface IActionRef<TClosure, T1, T2, T3, T4, T5> : IActionRef<TClosure>
public interface IActionRef<TClosure, in T1, in T2, in T3, in T4, in T5> : IActionRef<TClosure>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IActionRefArgIn<TClosure, T> : IActionRef<TClosure>
{
void SetArguments(in T arg);
}

public interface IActionRefArgIn<TClosure, T1, T2> : IActionRef<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IActionRefArgIn<TClosure, T1, T2, T3> : IActionRef<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IActionRefArgIn<TClosure, T1, T2, T3, T4> : IActionRef<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IActionRefArgIn<TClosure, T1, T2, T3, T4, T5> : IActionRef<TClosure>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
39 changes: 32 additions & 7 deletions System.Delegates/Func/IFunc.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
namespace System.Delegates
{
public interface IFunc<TResult>
public interface IFunc<out TResult>
{
TResult Invoke();
}

public interface IFunc<TClosure, TResult>
public interface IFunc<in TClosure, out TResult>
{
TResult Invoke(TClosure closure);
}

public interface IFunc<TClosure, T, TResult> : IFunc<TClosure, TResult>
public interface IFunc<in TClosure, in T, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(T arg);
}

public interface IFunc<TClosure, T1, T2, TResult> : IFunc<TClosure, TResult>
public interface IFunc<in TClosure, in T1, in T2, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2);
}

public interface IFunc<TClosure, T1, T2, T3, TResult> : IFunc<TClosure, TResult>
public interface IFunc<in TClosure, in T1, in T2, in T3, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3);
}

public interface IFunc<TClosure, T1, T2, T3, T4, TResult> : IFunc<TClosure, TResult>
public interface IFunc<in TClosure, in T1, in T2, in T3, in T4, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}

public interface IFunc<TClosure, T1, T2, T3, T4, T5, TResult> : IFunc<TClosure, TResult>
public interface IFunc<in TClosure, in T1, in T2, in T3, in T4, in T5, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IFuncArgIn<in TClosure, T, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(in T arg);
}

public interface IFuncArgIn<in TClosure, T1, T2, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IFuncArgIn<in TClosure, T1, T2, T3, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IFuncArgIn<in TClosure, T1, T2, T3, T4, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IFuncArgIn<in TClosure, T1, T2, T3, T4, T5, out TResult> : IFunc<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
25 changes: 25 additions & 0 deletions System.Delegates/Func/IFuncIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,29 @@ public interface IFuncIn<TClosure, T1, T2, T3, T4, T5, TResult> : IFuncIn<TClosu
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IFuncInArgIn<TClosure, T, TResult> : IFuncIn<TClosure, TResult>
{
void SetArguments(in T arg);
}

public interface IFuncInArgIn<TClosure, T1, T2, TResult> : IFuncIn<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IFuncInArgIn<TClosure, T1, T2, T3, TResult> : IFuncIn<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IFuncInArgIn<TClosure, T1, T2, T3, T4, TResult> : IFuncIn<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IFuncInArgIn<TClosure, T1, T2, T3, T4, T5, TResult> : IFuncIn<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
37 changes: 31 additions & 6 deletions System.Delegates/Func/IFuncRef.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
namespace System.Delegates
{
public interface IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, out TResult>
{
TResult Invoke(ref TClosure closure);
}

public interface IFuncRef<TClosure, T, TResult> : IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, in T, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(T arg);
}

public interface IFuncRef<TClosure, T1, T2, TResult> : IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, in T1, in T2, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2);
}

public interface IFuncRef<TClosure, T1, T2, T3, TResult> : IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, in T1, in T2, in T3, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3);
}

public interface IFuncRef<TClosure, T1, T2, T3, T4, TResult> : IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, in T1, in T2, in T3, in T4, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}

public interface IFuncRef<TClosure, T1, T2, T3, T4, T5, TResult> : IFuncRef<TClosure, TResult>
public interface IFuncRef<TClosure, in T1, in T2, in T3, in T4, in T5, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}

public interface IFuncRefArgIn<TClosure, T, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(in T arg);
}

public interface IFuncRefArgIn<TClosure, T1, T2, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2);
}

public interface IFuncRefArgIn<TClosure, T1, T2, T3, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3);
}

public interface IFuncRefArgIn<TClosure, T1, T2, T3, T4, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4);
}

public interface IFuncRefArgIn<TClosure, T1, T2, T3, T4, T5, out TResult> : IFuncRef<TClosure, TResult>
{
void SetArguments(in T1 arg1, in T2 arg2, in T3 arg3, in T4 arg4, in T5 arg5);
}
}
Loading

0 comments on commit 0043e9c

Please sign in to comment.