a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
29 lines
526 B
C#
29 lines
526 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class Test {
|
|
|
|
List<object> annotations = new List<object> ();
|
|
|
|
public IEnumerable<T> Annotations<T> () where T : class
|
|
{
|
|
foreach (T o in Annotations (typeof (T)))
|
|
yield return o;
|
|
}
|
|
|
|
public IEnumerable<object> 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<Test> ();
|
|
}
|
|
}
|