using System; using System.Collections.Generic; public class Test { List annotations = new List (); public IEnumerable Annotations () where T : class { foreach (T o in Annotations (typeof (T))) yield return o; } public IEnumerable Annotations (Type type) { if (annotations == null) yield break; foreach (object o in annotations) if (o.GetType () == type) yield return o; } public static void Main () { var test = new Test (); test.Annotations (); } }