VirtualFile コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > VirtualFile コンストラクタの意味・解説 

VirtualFile コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

VirtualFile クラス新しインスタンス初期化します。

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

Protected Sub New ( _
    virtualPath As String _
)
Dim virtualPath As String

Dim instance As New VirtualFile(virtualPath)
protected VirtualFile (
    string virtualPath
)
protected:
VirtualFile (
    String^ virtualPath
)
protected VirtualFile (
    String virtualPath
)
protected function VirtualFile (
    virtualPath : String
)

パラメータ

virtualPath

このインスタンスによって表されるリソースへの仮想パス

使用例使用例

カスタム VirtualPathProvider オブジェクトによって提供されDataSet オブジェクトから仮想ファイル情報取得する VirtualFile コンストラクタ実装する方法次のコード例示します例の実行必要なコード全体については、VirtualFile クラス概要で「例」を参照してください

Public Sub New(ByVal
 virtualPath As String, ByVal
 provider As SamplePathProvider)
  MyBase.New(virtualPath)
  spp = provider
  GetData()
End Sub

Protected Sub GetData()
  ' Get the data from the SamplePathProvider.
  Dim spp As SamplePathProvider
  spp = CType(HostingEnvironment.VirtualPathProvider, SamplePathProvider)

  Dim ds As DataSet
  ds = spp.GetVirtualData

  ' Get the virtual file data from the resource table.
  Dim files As DataTable
  files = ds.Tables("resource")

  Dim rows As DataRow()
  rows = files.Select( _
    String.Format("(name='{0}') AND (type='file')",
 Me.Name))

  ' If the select returned a row, store the file contents.
  If (rows.Length > 0) Then
    Dim row As DataRow
    row = rows(0)

    content = row("content").ToString()
  End If
End Sub
public SampleVirtualFile(string virtualPath,
 SamplePathProvider provider)
  : base(virtualPath)
{
  this.spp = provider;
  GetData();
}

protected void GetData()
{
  // Get the data from the SamplePathProvider
  DataSet ds = spp.GetVirtualData();

  // Get the virtual file from the resource table.
  DataTable files = ds.Tables["resource"];
  DataRow[] rows = files.Select(
    String.Format("(name = '{0}') AND (type='file')", this.Name));

  // If the select returned a row, store the file contents.
  if (rows.Length > 0)
  {
    DataRow row = rows[0];

    content = row["content"].ToString();
  }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
VirtualFile クラス
VirtualFile メンバ
System.Web.Hosting 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「VirtualFile コンストラクタ」の関連用語

VirtualFile コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



VirtualFile コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS