Cache.Count 属性

定义

获取缓存中存储的项数。Gets the number of items stored in the cache.

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

属性值

缓存中存储的项数。The number of items stored in the cache.

示例

Count下面的示例获取属性的值, 将其转换为字符串, 并将该字符串分配TextLabel Web 服务器控件Label1的属性。The following example obtains the value of the Count property, converts it to a string, and assigns the string to the Text property of a Label Web server control, Label1.

// Convert the Count property to a string
// and display its value in a Label server control. 
Label1.Text = "The number of items in the cache:" + Cache.Count.ToString();
' Convert the Count property to a string
' and display its value in a Label server control.    
 Label1.Text = "The number of items in the cache:" + Cache.Count.ToString()

注解

当监视应用程序的性能或使用 ASP.NET 跟踪功能时, 此属性非常有用。This property can be useful when monitoring your application's performance or when using ASP.NET tracing functionality.

适用于