TemplateInstanceAttribute.IsDefaultAttribute メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As TemplateInstanceAttribute Dim returnValue As Boolean returnValue = instance.IsDefaultAttribute
TemplateInstanceAttribute の現在のインスタンスの値が既定値である場合は true。それ以外の場合は false。


IsDefaultAttribute メソッドを使用する方法を次のコード例に示します。ASPX ページの Page_Load イベントで、MyLoginViewA カスタム コントロールの AnonymousTemplate プロパティの TemplateInstanceAttribute クラスが照会されます。
MyLoginViewA コントロールの定義については、TemplateInstanceAttribute のトピックを参照してください。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) ' Get the class type for which to access metadata. Dim clsType As Type = GetType(MyLoginViewA) ' Get the PropertyInfo object for FirstTemplate. Dim pInfo As PropertyInfo = clsType.GetProperty("AnonymousTemplate") ' See if the TemplateInstanceAttribute is defined for this property. Dim isDef As Boolean = Attribute.IsDefined(pInfo, GetType(TemplateContainerAttribute)) ' Display the result if the attribute exists. If isDef Then Dim tia As TemplateInstanceAttribute = CType(Attribute.GetCustomAttribute(pInfo, GetType(TemplateInstanceAttribute)), TemplateInstanceAttribute) Response.Write("The <AnonymousTemplate> has the TemplateInstanceAttribute = " & tia.Instances.ToString() & ".<br>") If (tia.IsDefaultAttribute()) Then Response.Write("The TemplateInstanceAttribute used is the same as the default instance.") Else Response.Write("The TemplateInstanceAttribute used is not the same as the default instance.") End If End If End Sub
protected void Page_Load(object sender, EventArgs e) { // Get the class type for which to access metadata. Type clsType = typeof(MyLoginViewA); // Get the PropertyInfo object for FirstTemplate. PropertyInfo pInfo = clsType.GetProperty("AnonymousTemplate"); // See if the TemplateInstanceAttribute is defined for this property. bool isDef = Attribute.IsDefined(pInfo, typeof(TemplateInstanceAttribute)); // Display the result if the attribute exists. if (isDef) { TemplateInstanceAttribute tia = (TemplateInstanceAttribute)Attribute.GetCustomAttribute(pInfo, typeof(TemplateInstanceAttribute)); Response.Write("The <AnonymousTemplate> has the TemplateInstanceAttribute = " + tia.Instances.ToString() + ".<br>"); if (tia.IsDefaultAttribute()) Response.Write("The TemplateInstanceAttribute used is the same as the default instance."); else Response.Write("The TemplateInstanceAttribute used is not the same as the default instance."); } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTemplateInstanceAttribute.IsDefaultAttribute メソッドを検索する場合は、下記のリンクをクリックしてください。

- TemplateInstanceAttribute.IsDefaultAttribute メソッドのページへのリンク