C# 如何组合IEnumerable和IRanked的结果?

C# 如何组合IEnumerable和IRanked的结果?,c#,C#,如何将所有结果合并到filteredDownResults中?作为背景,我使用NinjaNye.SearchExtensions。请询问您是否需要更多信息。非常适合任何输入 IEnumerable<proc_GetAllQuestions_Result> allResults = context.proc_GetAllQuestions(85).ToArray(); IRanked<proc_GetAllQuestions_Result>[] filteredDownRe

如何将所有结果合并到filteredDownResults中?作为背景,我使用NinjaNye.SearchExtensions。请询问您是否需要更多信息。非常适合任何输入

IEnumerable<proc_GetAllQuestions_Result> allResults = context.proc_GetAllQuestions(85).ToArray();
IRanked<proc_GetAllQuestions_Result>[] filteredDownResults = null;
filteredDownResults = allResults.Where(x => x.QuestionText == "marshmellows").ToArray();  //This doesn't work.

public interface IRanked<out T>
{
    int Hits { get; }
    T Item { get; }
}

public partial class proc_GetAllQuestions_Result
{
    public int Rank { get; set; }
    public Nullable<long> RowID { get; set; }
    public int PK_QuestionID { get; set; }
    public int PK_ProgramID { get; set; }
    public string ProgramName { get; set; }
    public string FK_AgencyID { get; set; }
    public Nullable<System.DateTime> ApprovedDateTime { get; set; }
    public string QuestionText { get; set; }
    public string FinalAnswer { get; set; }
    public string FK_SearchKeywords { get; set; }
    public string UpdatedFinalAnswer { get; set; }
    public Nullable<int> Archive { get; set; }
    public Nullable<int> FK_ProgramID { get; set; }
    public int ProgramAreaID { get; set; }
}
IEnumerable allResults=context.proc_GetAllQuestions(85.ToArray();
IRanked[]filteredDownResults=null;
filteredDownResults=allResults.Where(x=>x.QuestionText==“marshmellows”).ToArray()//这不管用。
公共接口被激活
{
int命中{get;}
T项{get;}
}
公共部分类过程\u GetAllQuestions\u结果
{
公共整数秩{get;set;}
公共可为空的RowID{get;set;}
public int PK_QuestionID{get;set;}
公共int PK_程序ID{get;set;}
公共字符串程序名{get;set;}
公共字符串FK_AgencyID{get;set;}
公共可空ApprovedDateTime{get;set;}
公共字符串QuestionText{get;set;}
公共字符串FinalAnswer{get;set;}
公共字符串FK_SearchKeywords{get;set;}
公共字符串UpdatedFinalAnswer{get;set;}
可为空的公共存档{get;set;}
公共可空FK_程序ID{get;set;}
公共int ProgramAreaID{get;set;}
}

如果我理解了你的问题,我能看到你的编码你不使用你的接口,你必须将结果发送到你的接口

var filteredDownResults = allResults.Search(x => x.QuestionText)
                                    .IsEqual("marshmellows")
                                    .ToRanked();

你到底面临什么问题?意外的空结果?异常?如果您可以显示您想要的结果,我们可以更好地理解…谢谢,到目前为止,我得到的错误是…严重性代码描述项目文件行抑制状态错误CS0266无法将类型“Dhs.PolicyQuest.UI.proc_GetAllQuestions_result[]”隐式转换为“NinjaNye.SearchExtensions.Models.IRanked[]”。存在明确的转换(您是否缺少演员阵容?)如果您的原始问题已解决,请记住接受并投票支持答案,如果您有其他问题,请提出新问题: