asp.net mvc - Convert object list to another object list even they are not same type -
i want separate between viewmodel , mode(data access object or data members). please see below.
major dao
public class major public majorid integer public majorname string end class
major vm
public class majorvm public major major end class
but major view model take reference major. in case, convert major object majorvm object list. please see below.
dim majorlist list(of major) = getallmajorlist() dim majorvmlist list(of majorvm) majorvmlist = majorlist
how can solve this? thanks.
try this.
dim majorvmlist new list(of majorvm) each item major in majorlist dim m new major major.majorid = item.majorid major.majorname = item.majorname majorvmlist.add(major) next
Comments
Post a Comment