MVC 컨트롤러에 매개 변수로 전달하는 동안 유형 또는 네임 스페이스 이름 'T'를 찾을 수 없습니다.

이샨 말릭

T를 매개 변수로 전달하고 있으며이 빌드 오류가 있습니다.

이것은 내 요구 사항입니다

public JsonResult SetGridProperties(Response<T> res)
    {
        res.ShowFilterRow = (!res.ShowFilterRow);
        return Json(true, JsonRequestBehavior.AllowGet);
    }

내 응답 클래스는 다음과 같습니다.

public class Response<T>
{
    public bool Status { get; set; }

    public string Message { get; set; }

    public T Data { get; set; }

    public List<T> DataList { get; set; }

    public MessageTypes MessageType { get; set; }

    public bool ShowFilterRow { get; set; }
    public bool AllowGroup { get; set; }        
}

이 Response 클래스를 동적 엔터티 개체가 'T'인 매개 변수로 사용하는 방법을 알려주십시오.

Karthik MR

메서드 정의에 T를 지정해야합니다.

public JsonResult SetGridProperties<T>(Response<T> res)
{
    res.ShowFilterRow = (!res.ShowFilterRow);
    return Json(true, JsonRequestBehavior.AllowGet);
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관