Kiran Thakur

Kiran Thakur

  • NA
  • 569
  • 548.6k

Convert single class to complex class

Aug 12 2016 9:48 PM
Hi,
 
I am facing a issue, I have a class called Question and i want to write a converter Question to Subject. How can i write a converter. Conversion happen on dynamic not static.
 
Input class
 
public class Question
{
public int SubjectId { get; set; }
public string SubjectName { get; set; }
public int SubjectOrder { get; set; }
public string SubjectDescription { get; set; }
public int QuestionId { get; set; }
public string QuestionName { get; set; }
public int QuestionOrder { get; set; }
public string QuestionDescription { get; set; }
}
 
 
Output Class
 
public class Subject {
public int SubjectId { get; set; }
public string SubjectName { get; set; }
public int SubjectOrder { get; set; }
public string SubjectDescription { get; set; }
public List<QuestionDetail> QuestionDetails { get; set; }
}
 
public class QuestionDetail {
public int QuestionId { get; set; }
public string QuestionName { get; set; }
public int QuestionOrder { get; set; }
public string QuestionDescription { get; set; }
}
 
How can i do that. Please help me. 

Answers (2)