Assuming you use a version of .Net that has LINQ, you can use the Intersect extension method:
var CommonList = TestList1.Intersect(TestList2)
More Related Contents:
- KeyValuePair with generic values [closed]
- Is there a constraint that restricts my generic method to numeric types?
- How do I clone a generic list in C#?
- Remove duplicates from a List in C#
- How to dynamically create generic C# object using reflection? [duplicate]
- Why isn’t there generic variance for classes in C# 4.0?
- Generics and casting – cannot cast inherited class to base class
- What is the best way to clone/deep copy a .NET generic Dictionary?
- Generic TryParse
- Generic constraints, where T : struct and where T : class
- Nullable type issue with ?: Conditional Operator
- How do I implement IEnumerable
- What does “where T : class, new()” mean?
- Generic All Controls Method
- Nullable reference types with generic return type
- Generic type conversion FROM string
- C# Generics won’t allow Delegate Type Constraints
- Generic C# Code and the Plus Operator [duplicate]
- Curiously Recurring Template Pattern and generics constraints (C#)
- Why generic IList does not inherit non-generic IList
- Is there a generic constraint I could use for the + operator?
- How to convert string to any type
- List readonly with a private set
- Why doesn’t C# support implied generic types on class constructors?
- How can I register a generic decorator using Castle Windsor?
- Creating a generic method in C#
- The component does not have a resource identified by the uri
- C# generic methods, type parameters in new() constructor constraint
- How does Java’s use-site variance compare to C#’s declaration site variance?
- Convert DataTable to Generic List in C#