public class Session
{
--private properties
private string p1;
private string p2;
private string p3;
.
.
.
.
private string p25;
--public properties
public string P1
{
get { return p1;}
set{p1=value;}
}
.
.
.
.
public string P25
{
get { return p25;}
set{p25=value;}
}
}
I have 25 public members in a class and when I make a IList of that class I get all the members . I want only specific 5 members to be part of that IList Because when i convert that ilist to datatable i get 25 columns but i want only 5 columns in datatable.
IList<Session> listSessionAttachment = new List<Session>();
Thanks in advance.
If you want to exclude some properties from mapping to your database, you have to apply special attributes to these properties. Attributes depend on the tools you use to work with the database.
For example, if you use Entity Framework, you should set [NotMapped] attribute to proprety.
If you use DevExpress XPO - you should use [NonPersistent] attribute.
I hope - this will solve your problem.