IsolatedStorageFileStream.Handle プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > IsolatedStorageFileStream.Handle プロパティの意味・解説 

IsolatedStorageFileStream.Handle プロパティ

メモ : このプロパティは、互換性のために残されています。

現在の IsolatedStorageFileStream オブジェクトによってカプセル化されるファイルファイル ハンドル取得しますIsolatedStorageFileStream オブジェクトではこのプロパティへのアクセス許可されておらず、IsolatedStorageException がスローさます。

名前空間: System.IO.IsolatedStorage
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ObsoleteAttribute("This property has been deprecated.
  Please use IsolatedStorageFileStream's SafeFileHandle property instead.
  http://go.microsoft.com/fwlink/?linkid=14202")> _
Public Overrides ReadOnly
 Property Handle As IntPtr
Dim instance As IsolatedStorageFileStream
Dim value As IntPtr

value = instance.Handle
[ObsoleteAttribute("This property has been deprecated.  Please use IsolatedStorageFileStream\'s
 SafeFileHandle property instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
 
public override IntPtr Handle { get; }
[ObsoleteAttribute(L"This property has been deprecated.  Please use IsolatedStorageFileStream\'s
 SafeFileHandle property instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
 
public:
virtual property IntPtr Handle {
    IntPtr get () override;
}
/** @property */
public IntPtr get_Handle ()

プロパティ
現在の IsolatedStorageFileStream オブジェクトによってカプセル化されるファイルファイル ハンドル

例外例外
例外種類条件

IsolatedStorageException

Handle プロパティは常にこの例外生成します

解説解説
使用例使用例

Handle プロパティコード例次に示します

Private Function GetPrefsForUser() As
 Boolean
    Try
        ' Retrieve an IsolatedStorageFile for the current Domain and
 Assembly.
        Dim isoFile As IsolatedStorageFile
 = _
            IsolatedStorageFile.GetStore(IsolatedStorageScope.User _
            Or IsolatedStorageScope.Assembly _
            Or IsolatedStorageScope.Domain, Nothing,
 Nothing)

        Dim isoStream As New
 IsolatedStorageFileStream(Me.userName, FileMode.Open, _
            FileAccess.Read, FileShare.Read)
        ' farThe code executes to this point only if a file corresponding
 to the username exists.
        ' Though you can perform operations on the stream, you cannot
 get a handle to the file.
        Try

            Dim aFileHandle As SafeFileHandle
 = isoStream.SafeFileHandle
            Console.WriteLine(("A pointer to a file handle has
 been obtained. " & aFileHandle.ToString() & "
 " & aFileHandle.GetHashCode()))

        Catch ex As Exception
            ' Handle the exception.
            Console.WriteLine("Expected exception")
            Console.WriteLine(ex.ToString())
        End Try

        Dim reader As New
 StreamReader(isoStream)
        ' Read the data.
        Me.NewsUrl = reader.ReadLine()
        Me.SportsUrl = reader.ReadLine()
        reader.Close()
        isoFile.Close()
        Return False
    Catch ex As System.IO.FileNotFoundException
        ' Expected exception if a file cannot be found. This indicates
 that we have a new user.
        Return True
    End Try
End Function 'GetPrefsForUser

private bool GetPrefsForUser()
{
    try
    {

        // Retrieve an IsolatedStorageFile for the current Domain and
 Assembly.
        IsolatedStorageFile isoFile =
            IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
            IsolatedStorageScope.Assembly |
            IsolatedStorageScope.Domain,
            null,
            null);

        IsolatedStorageFileStream isoStream =
            new IsolatedStorageFileStream(this.userName
,
            FileMode.Open,
            FileAccess.Read,
            FileShare.Read);

        // The code executes to this point only if a file corresponding
 to the username exists.
        // Though you can perform operations on the stream, you cannot
 get a handle to the file.

        try
        {

            SafeFileHandle aFileHandle = isoStream.SafeFileHandle;
            Console.WriteLine("A pointer to a file handle has been obtained.
 "
                + aFileHandle.ToString() + " "
                + aFileHandle.GetHashCode());
        }

        catch (Exception e)
        {
            // Handle the exception.
            Console.WriteLine("Expected exception");
            Console.WriteLine(e);
        }

        StreamReader reader = new StreamReader(isoStream);
        // Read the data.
        this.NewsUrl = reader.ReadLine();
        this.SportsUrl = reader.ReadLine();
        reader.Close();
        isoFile.Close();
        return false;
    }
    catch (System.IO.FileNotFoundException)
    {
        // Expected exception if a file cannot be found. This indicates
 that we have a new user.
        return true;
    }
}
[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)]
bool GetPrefsForUser()
{
   try
   {
      
      // Retrieve an IsolatedStorageFile for the current Domain and
 Assembly.
      IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast<IsolatedStorageScope>(IsolatedStorageScope::User
 | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr,
 nullptr );
      IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile
 );
      
      // farThe code executes to this point only if a file corresponding
 to the username exists.
      // Though you can perform operations on the stream, you cannot
 get a handle to the file.
      try
      {
         IntPtr aFileHandle = isoStream->Handle;
         Console::WriteLine( "A pointer to a file handle has been obtained.
 {0} {1}", aFileHandle, aFileHandle.GetHashCode() );
      }
      catch ( Exception^ e ) 
      {
         
         // Handle the exception.
         Console::WriteLine( "Expected exception" );
         Console::WriteLine( e->ToString() );
      }

      StreamReader^ reader = gcnew StreamReader( isoStream );
      
      // Read the data.
      this->NewsUrl = reader->ReadLine();
      this->SportsUrl = reader->ReadLine();
      reader->Close();
      isoFile->Close();
      isoStream->Close();
      return false;
   }
   catch ( Exception^ e ) 
   {
      
      // Expected exception if a file cannot be found. This indicates
 that we have a new user.
      String^ errorMessage = e->ToString();
      return true;
   }

}


.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
IsolatedStorageFileStream クラス
IsolatedStorageFileStream メンバ
System.IO.IsolatedStorage 名前空間



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

辞書ショートカット

すべての辞書の索引

IsolatedStorageFileStream.Handle プロパティのお隣キーワード
検索ランキング

   

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



IsolatedStorageFileStream.Handle プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS