using System; using System.Collections.Generic; using System.Linq; using Encompass.Exceptions; namespace Encompass { [AttributeUsage(AttributeTargets.Class)] public class ReadsImmediate : Attribute { public readonly HashSet ReadImmediateTypes = new HashSet(); public ReadsImmediate(params Type[] readImmediateTypes) { foreach (var readImmediateType in readImmediateTypes) { var isComponent = readImmediateType.GetInterfaces().Contains(typeof(IComponent)); if (!isComponent) { throw new IllegalReadTypeException("{0} must be a Component", readImmediateType.Name); } this.ReadImmediateTypes.Add(readImmediateType); } } } }