Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 困惑,现在我明白你的问题了。对问题进行编辑后,CRTP选项看起来是正确的。这些选择的方法在这里增加了很多混乱,很难弄清楚这里到底是怎么回事,但也许你不能让它变得更好,至少我不知道如何做到这一点。尽管如此,我还是会投票支持CRTP选项,因为每次覆盖所有内容(_C#_Linq_Design Patterns_Remote Server_Template Specialization - Fatal编程技术网

C# 困惑,现在我明白你的问题了。对问题进行编辑后,CRTP选项看起来是正确的。这些选择的方法在这里增加了很多混乱,很难弄清楚这里到底是怎么回事,但也许你不能让它变得更好,至少我不知道如何做到这一点。尽管如此,我还是会投票支持CRTP选项,因为每次覆盖所有内容(

C# 困惑,现在我明白你的问题了。对问题进行编辑后,CRTP选项看起来是正确的。这些选择的方法在这里增加了很多混乱,很难弄清楚这里到底是怎么回事,但也许你不能让它变得更好,至少我不知道如何做到这一点。尽管如此,我还是会投票支持CRTP选项,因为每次覆盖所有内容(,c#,linq,design-patterns,remote-server,template-specialization,C#,Linq,Design Patterns,Remote Server,Template Specialization,困惑,现在我明白你的问题了。对问题进行编辑后,CRTP选项看起来是正确的。这些选择的方法在这里增加了很多混乱,很难弄清楚这里到底是怎么回事,但也许你不能让它变得更好,至少我不知道如何做到这一点。尽管如此,我还是会投票支持CRTP选项,因为每次覆盖所有内容(选项1)对我来说太过繁重了。我试过一次,但仍然完成了CRTP。如果您的层次结构不小,那么您应该使用CRTP。如果它非常小-第一个选项可能是一个选择,然后 interface ISelection<out T> { ISele

困惑,现在我明白你的问题了。对问题进行编辑后,CRTP选项看起来是正确的。这些选择的方法在这里增加了很多混乱,很难弄清楚这里到底是怎么回事,但也许你不能让它变得更好,至少我不知道如何做到这一点。尽管如此,我还是会投票支持CRTP选项,因为每次覆盖所有内容(选项1)对我来说太过繁重了。我试过一次,但仍然完成了CRTP。如果您的层次结构不小,那么您应该使用CRTP。如果它非常小-第一个选项可能是一个选择,然后
interface ISelection<out T> {
    ISelection<T> Skip(int n);
    ISelection<T> Method2();
    ISelection<T> Method3();
    ISelection<T> Method4();

    ISelection<TResult> Select<TResult>(Func<T, TResult> selector);
    IDateTimeSelection Select(Func<T, DateTime> selector);

    IResult<T> Submit();
}

interface IDateTimeSelection : ISelection<DateTime> {
    new IDateTimeSelection Skip(int n);
    new IDateTimeSelection Method2();
    new IDateTimeSelection Method3();
    new IDateTimeSelection Method4();

    IDateTimeSelection SpecialMethod();
}
interface IBaseSelection<out Selection, out T> where Selection : IBaseSelection<Selection, T> {
    Selection Skip(int n);
    Selection Method2();
    Selection Method3();
    Selection Method4();

    ISelection<TResult> Select<TResult>(Func<T, TResult> selector);
    IDateTimeSelection Select(Func<T, DateTime> selector);

    IResult<T> Submit();
}

interface ISelection<out T> : IBaseSelection<ISelection<T>, T> {
}

interface IDateTimeSelection : IBaseSelection<IDateTimeSelection, DateTime> {
    IDateTimeSelection SpecialMethod();
}
ISelection<Dataset> datasets = ...
var result = datasets
    .Select(dataset => dataset.Date)
    .Skip(5)
    .SpecialMethod()
    .Submit();
    public interface ISelection<out T>
    {
        T Skip(int n);
        T Method2();
        T Method3();
        T Method4();
        T SpecialMethod();
    }
public interface ISelection<out T>
    where T : ISelection<T>
{
    T Skip(int n);
    T Method2();
    T Method3();
}

public interface IDateTimeSelection<out T> : ISelection<T>
    where T : IDateTimeSelection<T>
{
    T SpecialMethod();
}

public class Implementation : IDateTimeSelection<Implementation>
{
    public Implementation Skip(int n)
    {
        return this;
    }

    public Implementation Method2()
    {
        return this;
    }

    public Implementation Method3()
    {
        return this;
    }

    public Implementation SpecialMethod()
    {
        return this;
    }
}
        var impl = new Implementation2();
        impl.Skip(2).Method2().Method3().SpecialMethod().Method2();