private static (string, VendorId) Lookup(string cpuName) { var result = PCI_ID.FirstOrDefault(MatchVendorName); return(result.Item2 == null ? ("Other", VendorId.Other) : (result.Item2, result.Item3)); bool MatchVendorName((uint, string, VendorId) item) { var(_, vendor, _) = item; return(cpuName.Contains(vendor)); } }
private static (string, VendorId) Lookup(uint vendorId) { // linear search is fine - we only call this a few times // (usually once or twice) and we don't search a giant list var result = PCI_ID.FirstOrDefault(MatchVendorId); return(result.Item2 == null ? ("Other", VendorId.Other) : (result.Item2, result.Item3)); bool MatchVendorId((uint, string, VendorId) item) { return(item.Item1 == vendorId); } }