I have a custom property (to binding in a Grid) like that :
public class MyClass
{
public virtual IList<clsClass2> MyList{ get; set; } //Lazy loaded
public virtual string CustomProperty //To use on Grid Binding
{
get
{
if (!MyList.IsNullOrEmpty())
return MyList.Select(__comp => __comp.Name).ToList().ToString(", ");
return string.Empty;
}
}
}
Its working fine... But that way everytime I load a MyClass object, its load every MyList element because of the CustomProperty...
Is there a better way to do that?
Thanks