DelegatingSupplier<T1, T2, TResult>
public struct DelegatingSupplier<T1, T2, TResult> : ISupplier<T1, T2, TResult>, IFunctional<Func<T1, T2, TResult>>, IEquatable<DelegatingSupplier<T1, T2, TResult>>
Represents implementation of ISupplier<T, U, V> that delegates
invocation to the delegate of type Func<T, U, V>.
using DotNext.Runtime.CompilerServices;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace DotNext
{
[StructLayout(LayoutKind.Auto)]
public readonly struct DelegatingSupplier<[Nullable(2)] T1, [Nullable(2)] T2, [Nullable(2)] TResult> : ISupplier<T1, T2, TResult>, IFunctional<Func<T1, T2, TResult>>, IEquatable<DelegatingSupplier<T1, T2, TResult>>
{
private readonly Func<T1, T2, TResult> func;
public bool IsEmpty => func == null;
[NullableContext(1)]
public DelegatingSupplier(Func<T1, T2, TResult> func)
{
if (func == null)
throw new ArgumentNullException("func");
this.func = func;
}
TResult ISupplier<T1, T2, TResult>.Invoke(T1 arg1, T2 arg2)
{
return func(arg1, arg2);
}
Func<T1, T2, TResult> IFunctional<Func<T1, T2, TResult>>.ToDelegate()
{
return func;
}
[NullableContext(2)]
public override string ToString()
{
return func?.ToString();
}
public static implicit operator DelegatingSupplier<T1, T2, TResult>(Func<T1, T2, TResult> func)
{
return new DelegatingSupplier<T1, T2, TResult>(func);
}
[CompilerGenerated]
private bool PrintMembers(StringBuilder builder)
{
builder.Append("IsEmpty = ");
builder.Append(IsEmpty.ToString());
return true;
}
public static bool operator !=(DelegatingSupplier<T1, T2, TResult> left, DelegatingSupplier<T1, T2, TResult> right)
{
return !(left == right);
}
public static bool operator ==(DelegatingSupplier<T1, T2, TResult> left, DelegatingSupplier<T1, T2, TResult> right)
{
return left.Equals(right);
}
[CompilerGenerated]
public override int GetHashCode()
{
return EqualityComparer<Func<T1, T2, TResult>>.Default.GetHashCode(func);
}
[CompilerGenerated]
public override bool Equals(object obj)
{
if (obj is DelegatingSupplier<T1, T2, TResult>)
return Equals((DelegatingSupplier<T1, T2, TResult>)obj);
return false;
}
[CompilerGenerated]
public bool Equals(DelegatingSupplier<T1, T2, TResult> other)
{
return EqualityComparer<Func<T1, T2, TResult>>.Default.Equals(func, other.func);
}
}
}