共用方式為


AggregateCacheDependency 建構函式

定義

初始化 AggregateCacheDependency 類別的新執行個體。

public:
 AggregateCacheDependency();
public AggregateCacheDependency ();
Public Sub New ()

範例

下列程式碼範例會使用不採用引數的建構函式,建立 類別的 AggregateCacheDependency 實例。 系統會建立兩 CacheDependencyCacheDependency 物件,然後將 新增至陣列 。 myDepArray 這個建構函式會與 Add 方法搭配使用,讓專案儲存在 Cache 相依于這兩 CacheDependency 個物件。

         ' Create two CacheDependency objects, one to a
         ' text file and the other to an XML file. 
         ' Create a CacheDependency array with these 
         ' two objects as items in the array.
          txtDep = New CacheDependency(Server.MapPath("Storage.txt"))
          xmlDep = New CacheDependency(Server.MapPath("authors.xml"))
          Dim DepArray() As CacheDependency = {txtDep, xmlDep}

          ' Create an AggregateCacheDependency object and 
          ' use the Add method to add the array to it.   
          aggDep = New AggregateCacheDependency()
          aggDep.Add(DepArray)

          ' Call the GetUniqueId method to generate
          ' an ID for each dependency in the array.
          msg1.Text = aggDep.GetUniqueId()
          
          ' Add the new data set to the cache with 
          ' dependencies on both files in the array.
          Cache.Insert("XMLDataSet", Source, aggDep)

備註

這是 類別的 AggregateCacheDependency 無參數建構函式。

適用於