英語で読む

次の方法で共有


UrlPropertyAttribute クラス

定義

コントロールで URL 値を含む文字列プロパティを識別するために使用される属性を定義します。 このクラスは継承できません。

C#
[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class UrlPropertyAttribute : Attribute
継承
UrlPropertyAttribute
属性

次のコード例は、URL 固有のプロパティを実装するクラスを示しています。 このコード例では、UrlPropertyAttribute属性がクラスのプロパティにTargetUrl``CustomHyperLinkControl適用されます。 この属性は、ASP.NET ファイルの特定のファイル フィルターを設定します。

C#
public class CustomHyperLinkControl : WebControl
{
    public CustomHyperLinkControl() { }

    // The TargetUrl property represents the URL that 
    // the custom hyperlink control navigates to.
    [UrlProperty("*.aspx")]
    public string TargetUrl
    {
        get
        {
            string s = (string)ViewState["TargetUrl"];
            return ((s == null) ? String.Empty : s);
        }
        set
        {
            ViewState["TargetUrl"] = value;
        }
    }

    // The Text property represents the visible text that 
    // the custom hyperlink control is displayed with.        
    public virtual string Text
    {
        get
        {
            string s = (string)ViewState["Text"];
            return ((s == null) ? String.Empty : s);
        }
        set
        {
            ViewState["Text"] = value;
        }
    }

    // Implement method to render the control.
}

注釈

この UrlPropertyAttribute 属性は、URL を表すコントロール プロパティに適用される属性です。 この属性は、文字列プロパティを URL を表すものとしてマークするだけでなく、 UrlPropertyAttribute プロパティに Filter 対してフィルター処理するために使用できる特定のファイルの種類を識別するプロパティを定義します。

コンストラクター

UrlPropertyAttribute()

UrlPropertyAttribute クラスの新しい既定のインスタンスを初期化します。

UrlPropertyAttribute(String)

UrlPropertyAttribute クラスの新しいインスタンスを初期化し、Filter プロパティを指定した文字列に設定します。

プロパティ

Filter

URL 固有のプロパティに関連付けられたファイル フィルターを取得します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

GetHashCode()

このインスタンスのハッシュ コードを返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

製品 バージョン
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8