Home sort list of Controls from a custom class type
Reply: 0

sort list of Controls from a custom class type

user8110
1#
user8110 Published in September 21, 2018, 8:03 am

I have a problem in order my list, I check most of the example but I think my problem is unique. Please check and help me to get it done.

List<Control> lc = new List<Control>();

foreach (Control control in fLP.Controls)
{
   Dashboard_Env_Details ded =  (Dashboard_Env_Details)control;
   ded.refreshUC();
   lc.Add(control);
}

List<Control> Sortedlc = lc.OrderBy((o => ((Dashboard_Env_Details)o).custTask.getNoInvalidObjects).ToList();

I am receiving below error:

Severity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'Enumerable.OrderBy(IEnumerable, Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly. KeepMyServerInfo C:\Users\CM_Dashboard.cs 141 Active

share|improve this question
  • 3
    What problem do you have? – Tim Schmelter Feb 14 at 9:12
  • 1
    Please specify the problem more thoroughly and also tell us what is custTask and getNoInvalidObjects – Martin Zikmund Feb 14 at 9:14
  • @MartinZikmund: consider those as two simple class. – Amir Feb 14 at 9:58
  • @TimSchmelter: added – Amir Feb 14 at 9:58

1 Answer 1

active oldest votes
up vote 4 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.294129 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO