PartialCachingAttribute.VaryByCustom 屬性

定義

取得自訂字串的清單,輸出快取將使用此清單來變更使用者控制項。

public:
 property System::String ^ VaryByCustom { System::String ^ get(); };
public:
 property System::String ^ VaryByCustom { System::String ^ get(); void set(System::String ^ value); };
public string VaryByCustom { get; }
public string VaryByCustom { get; set; }
member this.VaryByCustom : string
member this.VaryByCustom : string with get, set
Public ReadOnly Property VaryByCustom As String
Public Property VaryByCustom As String

屬性值

自訂字串的清單。

範例

下列程式碼範例示範如何將建 PartialCachingAttribute(Int32, String, String, String) 構函式套用至使用者控制項。 在此範例中,建構函式用來指出可以快取使用者控制項,並指定快取專案相依于瀏覽器類型和主要版本號碼。

// Set the PartialCachingAttribute.Duration property to
// 20 seconds and the PartialCachingAttribute.VaryByCustom
// property to browser.
[PartialCaching(20, null, null, "browser")]
public partial class ctlSelect : UserControl
' Set the PartialCachingAttribute.Duration property to
' 20 seconds and the PartialCachingAttribute.VaryByCustom
' property to browser.
<PartialCaching(20, Nothing, Nothing, "browser")> _
Public Class ctlSelect
    Inherits UserControl

備註

如果您為此屬性指定 「browser」,則使用者控制項會因瀏覽器類型和主要版本號碼而有所不同。 您也可以使用這個屬性來擴充輸出快取會因使用者控制項回應而異的值。

適用於