Boo.Lang.Compiler.Steps.GeneratorExpressionProcessor.GetMember C# (CSharp) Метод

GetMember() приватный Метод

Gets the member of the specified type with the specified name, assuming there is only one.
private GetMember ( IType type, string name, EntityType entityType ) : IEntity
type IType
name string
entityType EntityType
Результат IEntity
        private IEntity GetMember(IType type, string name, EntityType entityType)
        {
            // For external types we can use GetMethod or GetProperty to optimize things a little
            ExternalType external = type as ExternalType;
            if (external != null)
            {
                if (entityType == EntityType.Property)
                {
                    return TypeSystemServices.Map(
                        ((ExternalType)type).ActualType.GetProperty(name));
                }

                else if (entityType == EntityType.Method)
                {
                    return TypeSystemServices.Map(
                        ((ExternalType)type).ActualType.GetMethod(name));

                }
            }

            // For constructed types which aren't external we can use the GenericMapping to
            // (maybe) optimize things a little
            if (type.ConstructedInfo != null)
            {
                return ((GenericConstructedType)type).GenericMapping.Map(
                    GetMember(type.ConstructedInfo.GenericDefinition, name, entityType));
            }

            // For other cases we just scan through the members collection
            return Array.Find<IEntity>(
                type.GetMembers(),
                delegate(IEntity e) {
                    return entityType == e.EntityType && e.Name == name;
                });
        }