티스토리 뷰

🌈 .NET MVC

제너릭 형식 메소드

James Wetzel 2021. 5. 30. 19:46
728x90
반응형
var test1 = this.Wordbook.WordbookListT<List<Wordbook_Select_List_AtWordView_Result>>(1);
var test2 = this.Wordbook.WordbookListT<List<Wordbook_Select_List_Result>>(1);

		T IWordbook.List<T>(long memberNo)
        {
            if(typeof(T) == typeof(List<Wordbook_Select_List_AtWordView_Result>))
            {
                return (T)Convert.ChangeType(this.DoctorslDCC.Wordbook_Select_List_AtWordView(memberNo).ToList<Wordbook_Select_List_AtWordView_Result>(), typeof(T));
            }
            else if (typeof(T) == typeof(List<Wordbook_Select_List_Result>))
            {
                return (T)Convert.ChangeType(this.DoctorslDCC.Wordbook_Select_List_My(memberNo).ToList<Wordbook_Select_List_Result>(), typeof(T));
            }
            else
            {
                return (T)Convert.ChangeType(null, typeof(T));
            }
        }
        
728x90
반응형