当前位置: 首页>>代码示例>>C#>>正文


C# TemplateParser.GetType方法代码示例

本文整理汇总了C#中System.Web.UI.TemplateParser.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# TemplateParser.GetType方法的具体用法?C# TemplateParser.GetType怎么用?C# TemplateParser.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.TemplateParser的用法示例。


在下文中一共展示了TemplateParser.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

    private bool _fLateBinding; // Force latebinding when early binding could be done


    /// <internalonly/>
    /// <devdoc>
    /// </devdoc>
    public override void Init(TemplateParser parser, ControlBuilder parentBuilder,
        Type type, string tagName,
        string id, IDictionary attribs) {

        if (id == null) {
            throw new HttpException(
                SR.GetString(SR.Object_tag_must_have_id));
        }

        ID = id;

        // Get the scope attribute of the object tag
        string scope = (string) attribs["scope"];

        // Map it to an ObjectTagScope enum
        if (scope == null)
            _scope = ObjectTagScope.Default;
        else if (StringUtil.EqualsIgnoreCase(scope, "page"))
            _scope = ObjectTagScope.Page;
        else if (StringUtil.EqualsIgnoreCase(scope, "session"))
            _scope = ObjectTagScope.Session;
        else if (StringUtil.EqualsIgnoreCase(scope, "application"))
            _scope = ObjectTagScope.Application;
        else if (StringUtil.EqualsIgnoreCase(scope, "appinstance"))
            _scope = ObjectTagScope.AppInstance;
        else
            throw new HttpException(SR.GetString(SR.Invalid_scope, scope));

        Util.GetAndRemoveBooleanAttribute(attribs, "latebinding",
            ref _fLateBinding);

        string tmp = (string) attribs["class"];

        // Is there a 'class' attribute?
        if (tmp != null) {
            // Get a Type object from the type string
            _type = parser.GetType(tmp);
        }

        // If we don't have a type, check for a classid attribute
        if (_type == null) {
            tmp = (string) attribs["classid"];

            if (tmp != null) {
                // Create a Guid out of it
                Guid clsid = new Guid(tmp);

                // Turn it into a type
                _type = Type.GetTypeFromCLSID(clsid);

                if (_type == null)
                    throw new HttpException(SR.GetString(SR.Invalid_clsid, tmp));

                // 




                if (_fLateBinding || Util.IsLateBoundComClassicType(_type)) {
                    _lateBound = true;
                    _clsid = tmp;
                }
                else {

                    // Add a dependency to the type, so that the user can use it without
                    // having to import it
                    parser.AddTypeDependency(_type);
                }
            }
        }

        // If we don't have a type, check for a progid attribute
        if (_type == null) {
            tmp = (string) attribs["progid"];

            if (tmp != null) {
#if !FEATURE_PAL // FEATURE_PAL does not enable COM
                // Turn it into a type
                _type = Type.GetTypeFromProgID(tmp);
#else // !FEATURE_PAL
                throw new NotImplementedException("ROTORTODO");
#endif // !FEATURE_PAL


                if (_type == null)
                    throw new HttpException(SR.GetString(SR.Invalid_progid, tmp));

                Debug.Trace("Template", "<object> type: " + _type.FullName);

                // 




//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:ObjectTag.cs

示例2: ControlBuilder

		internal ControlBuilder (TemplateParser parser,
					 ControlBuilder parentBuilder,
					 Type type,
					 string tagName,
					 string id,
					 IDictionary attribs,
					 int line,
					 string sourceFileName)

		{
			this.parser = parser;
			this.parserType = parser != null ? parser.GetType () : null;
			this.parentBuilder = parentBuilder;
			this.type = type;
			this.tagName = tagName;
			this.id = id;
			this.attribs = attribs;
			this.line = line;
			this.fileName = sourceFileName;
		}
开发者ID:afaerber,项目名称:mono,代码行数:20,代码来源:ControlBuilder.cs

示例3: Init

 public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs)
 {
     if (id == null)
     {
         throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_id"));
     }
     base.ID = id;
     string str = (string) attribs["scope"];
     if (str == null)
     {
         this._scope = ObjectTagScope.Default;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "page"))
     {
         this._scope = ObjectTagScope.Page;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "session"))
     {
         this._scope = ObjectTagScope.Session;
     }
     else if (StringUtil.EqualsIgnoreCase(str, "application"))
     {
         this._scope = ObjectTagScope.Application;
     }
     else
     {
         if (!StringUtil.EqualsIgnoreCase(str, "appinstance"))
         {
             throw new HttpException(System.Web.SR.GetString("Invalid_scope", new object[] { str }));
         }
         this._scope = ObjectTagScope.AppInstance;
     }
     Util.GetAndRemoveBooleanAttribute(attribs, "latebinding", ref this._fLateBinding);
     string typeName = (string) attribs["class"];
     if (typeName != null)
     {
         this._type = parser.GetType(typeName);
     }
     if (this._type == null)
     {
         typeName = (string) attribs["classid"];
         if (typeName != null)
         {
             Guid clsid = new Guid(typeName);
             this._type = Type.GetTypeFromCLSID(clsid);
             if (this._type == null)
             {
                 throw new HttpException(System.Web.SR.GetString("Invalid_clsid", new object[] { typeName }));
             }
             if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
             {
                 this._lateBound = true;
                 this._clsid = typeName;
             }
             else
             {
                 parser.AddTypeDependency(this._type);
             }
         }
     }
     if (this._type == null)
     {
         typeName = (string) attribs["progid"];
         if (typeName != null)
         {
             this._type = Type.GetTypeFromProgID(typeName);
             if (this._type == null)
             {
                 throw new HttpException(System.Web.SR.GetString("Invalid_progid", new object[] { typeName }));
             }
             if (this._fLateBinding || Util.IsLateBoundComClassicType(this._type))
             {
                 this._lateBound = true;
                 this._progid = typeName;
             }
             else
             {
                 parser.AddTypeDependency(this._type);
             }
         }
     }
     if (this._type == null)
     {
         throw new HttpException(System.Web.SR.GetString("Object_tag_must_have_class_classid_or_progid"));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:86,代码来源:ObjectTagBuilder.cs


注:本文中的System.Web.UI.TemplateParser.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。