Forge/Integration/DataRegistry.cs
/// <summary>
/// Returns all types that have a CustomDataRegistryAttribute attribute.
/// </summary>
Returns all types that have a CustomDataRegistryAttribute attribute.
Returns all types that have a CustomDataRegistryAttribute attribute .
private static IEnumerable<Tuple<Type, AttributeType>> GetTypesWithAttribute<AttributeType>()
            where AttributeType : Attribute {
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
                foreach (Type type in assembly.GetTypes()) {
                    object[] attributes = type.GetCustomAttributes(typeof(AttributeType), true);
                    if (attributes.Length > 0) {
                        yield return Tuple.Create(type, (AttributeType)attributes[0]);
                    }
                    if (attributes.Length > 1) {
                        throw new InvalidOperationException("Too many satisfying attributes");
                    }
                }
            }
        }
private static IEnumerable < Tuple < Type , AttributeType > > GetTypesWithAttribute < AttributeType > ( ) where AttributeType : Attribute { foreach ( var assembly in AppDomain . CurrentDomain . GetAssemblies ( ) ) { foreach ( Type type in assembly . GetTypes ( ) ) { object [ ] attributes = type . GetCustomAttributes ( typeof ( AttributeType ) , true ) ; if ( attributes . Length > 0 ) { yield return Tuple . Create ( type , ( AttributeType ) attributes [ 0 ] ) ; } if ( attributes . Length > 1 ) { throw new InvalidOperationException ( " " ) ; } } } }
Returns all types that have a CustomDataRegistryAttribute attribute.
Returns all types that have a CustomDataRegistryAttribute attribute .