CreateNestedDirective() public method

public CreateNestedDirective ( String name ) : Directive
name String
return Directive
コード例 #1
0
ファイル: DirectiveManager.cs プロジェクト: leon-wu/NVelocity
        public virtual Directive Create(String name, Stack directiveStack)
        {
            Type type = (Type)name2Type[name];

            if (type == null)
            {
                if (directiveStack.Count != 0)
                {
                    Directive parent = (Directive)directiveStack.Peek();

                    if (parent.SupportsNestedDirective(name))
                    {
                        return(parent.CreateNestedDirective(name));
                    }
                }
            }
            else
            {
                return((Directive)Activator.CreateInstance(type));
            }

            return(null);
        }
コード例 #2
0
        public virtual Directive Create(string name, Stack directiveStack)
        {
            Type      type = (Type)this.name2Type[name];
            Directive result;

            if (type != null)
            {
                result = (Directive)Activator.CreateInstance(type);
            }
            else
            {
                if (directiveStack.Count != 0)
                {
                    Directive directive = (Directive)directiveStack.Peek();
                    if (directive.SupportsNestedDirective(name))
                    {
                        result = directive.CreateNestedDirective(name);
                        return(result);
                    }
                }
                result = null;
            }
            return(result);
        }