Hi.
for fill datagridview use linq.
var select = db.TBL_Names.OrderByDescending(f => f.Id).ToList().Select((c, index) => new
{
c.Id,
RowIndex = index + 1,
VerySlowPageIsTheCode = !c.Table2s.Any()
? "is valid"
: c.Table2s.OrderByDescending(d => d.Id)
.FirstOrDefault()
.Bool.Choose("is valid",
true, "invalid",
false, "is valid"),
Username = c.Name + " " + c.Family
});
dgv.DataSource = select;
---------------------------------
//Choose is extension method:
public static class ClsChoose
{
public static object Choose<T>(this T v1, object elseValue, params object[] values) where T : IEquatable<T>
{
for (int i = 0; i < values.Length; i += 2)
if ((( ...
Go to the complete details ...