次の方法で共有


Cache.Count プロパティ

キャッシュ内に格納されている項目の数を取得します。

名前空間: System.Web.Caching
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public ReadOnly Property Count As Integer
'使用
Dim instance As Cache
Dim value As Integer

value = instance.Count
public int Count { get; }
public:
property int Count {
    int get ();
}
/** @property */
public int get_Count ()
public function get Count () : int
適用できません。

プロパティ値

キャッシュ内に格納されている項目の数。

解説

このプロパティは、アプリケーションのパフォーマンスを監視する場合や、ASP.NET のトレース機能を使用する場合に役立ちます。

使用例

Count プロパティの値を取得して文字列に変換し、この文字列を Label Web サーバー コントロール (Label1) の Text プロパティに設定する例を次に示します。

' 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();

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

Cache クラス
Cache メンバ
System.Web.Caching 名前空間