ashx文件奇怪的麻烦

时间:2017-03-05 07:08:05

标签: .net c#-4.0 type-conversion handler

我的经纪人早上好,我有这个错误:

Impossibile convertire implicitamente il tipo 'System.Collections.Generic.List<Personale> [c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll]' in 'System.Collections.Generic.List<Personale> [c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll]'

这里是代码

<%@ WebHandler Language="C#" Class="MissioniS" %>

using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;

public class MissioniS : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string stringa = context.Request.QueryString["q"];
        int idCalamita = Convert.ToInt32(context.Request.QueryString["id"]);

        Dipendenti dip = new Dipendenti();
        List<DataRow> missDt = dip.missS(idCalamita, true);

        List<Personale> persLst = dip.ElencoDipendenti();

        var query = (from pers in persLst
                     join miss in missDt
                     on pers.CodFis equals miss.Field<string>("CODFISDIP")
                     orderby miss.Field<DateTime>("DataOraInizio")
                     select new
                     {
                         progMiss = miss.Field<decimal>("GMIS"),
                         descrizione = string.Concat(miss.Field<decimal>("GMIS").ToString(), " ", pers.Cognome, " ", pers.Nome, " ", pers.CodFis, " Dal ", miss.Field<DateTime>("DataOraInizio").ToString("dd/MM/yyyy"), " Al ", miss.Field<DateTime>("DataOraFine").ToString("dd/MM/yyyy"), " ", miss.Field<string>("LDEST"))
                     }).Where(f => f.descrizione.Contains(stringa.ToUpper()));

        foreach (var r in query)
        {
            context.Response.Write(string.Concat(r.descrizione, "|", r.progMiss, Environment.NewLine));
        }

    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

错误指的是:

List<Personale> persLst = dip.ElencoDipendenti();

是一个奇怪的错误,因为两边的类型相同,并且没有显示文本的下划线。

有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

我解决了:还有另一个名为“Personale”的课程