Hi below is my format in which my object data is stored. I am new to linq.
Server1, Database, MySQL, 5.5
Server2, Database, MySQL, 5.1
Server3, OS, Ubuntu, 10.04
Server1, OS, Ubuntu, 10.04
Server2, OS, Ubuntu, 12.04
Server3, Language, Python, 2.6.3
Below is my class structure.
public class dettails
{
public string server { get; set; }
public string details1 { get; set; }
public string details2 { get; set; }
public string version { get; set; }
public dettails(string Server, string Details1, string Details2, string Version)
{
server = Server;
details1 = Details1;
details2 = Details2;
version = Version;
}
}
Below is code that haas added data in my List of object.
List<dettails> objEmps = new List<dettails>();
while ((line = sr.ReadLine()) != null)
{
objEmps.Add(new dettails(fields[0].ToString().Trim(), fields[1].ToString().Trim(), fields[2].ToString().Trim(), fields[3].ToString().Trim()));
}
I want an output using linq like below.
A list of software package names for which an out-of-date version (i.e. a version which is not the latest version) is installed on at least 2 different servers.
Thus, in this case, the output of your program should be:
Ubuntu Because Ubuntu 10.04 is an out-of-date version (the latest version is 12.04), and it is installed on two servers (Server 3, and Server 1).
How can i achieve it using linq. Please advice