CSharp examples for System.Collections.Generic:ICollection
Find Collection Interface from Type
using System.Reflection; using System.Collections.Generic; using System.Collections; using System;//from w w w . java 2s . com public class Main{ private static Type FindCollectionInterface(Type type) { var interfaces = type.FindInterfaces((t, o) => { if (t.IsGenericType) return t.GetGenericTypeDefinition() == typeof(ICollection<>); return false; }, null); return (interfaces.Length == 1) ? interfaces[0] : null; } }