Recently we are converting Datatable to List of Models.. I had a class called Person ( personid ,PersonChildId} and I implemented my class as

public class Person 
{
    public Int64 PerosnId{ get; set; }
    public Int64 PersonChildID{ get; set; }
}

I sucessfully converted my Datatable to List<Person> by using simple for loop. But now the problem is as we know Datacolumn has a property called Caption. but unfortunately models don't have.
So how do we need implement a Caption property for the Model for these kind of scenarios.

You can create base class, like Model, that has the Caption property, and the Person class would extend the Model class, this way it would inherit the property. And every other class that extends Model would also have the Caption property.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.