public struct RegistryApp
{
public string VendorName;
public string Name;
public string Version;
}
I Have two List<RegistryApp>
which hold all Applications currently installed on the Windows box. Why two? Well I have one List to hold all x86
Applications and one to hold all x64
Applications.
List<RegistryApp> x64Apps64List = new List<RegistryApp>();
List<RegistryApp> x64Apps32List = new List<RegistryApp>();
Once those two are populated with their appropriate data which was retrieved from the registry, I try the following to make sure there are no duplicates. This worked decently on List<string>
but not working with List<RegistryApp>
.
List<RegistryApp> ListOfAllAppsInstalled = new List<RegistryApp>();
IEnumerable<RegistryApp> x86Apps = x64Apps32List.Except(x64Apps64List);
IEnumerable<RegistryApp> x64Apps = x64Apps64List.Except(x64Apps32List);
foreach (RegistryApp regitem in x86Apps)
{
if ((regitem.Name != null) &&
(regitem.Name.Length > 2) &&
(regitem.Name != ""))
{
ListOfAllAppsInstalled.Add(regitem);
}
}
foreach (RegistryApp regitem in x64Apps)
{
if ((regitem.Name != null) &&
(regitem.Name.Length > 2) &&
(regitem.Name != ""))
{
ListOfAllAppsInstalled.Add(regitem);
}
}
Any way to pull this off?