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

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

Stream.CanWrite プロパティ

派生クラスオーバーライドされた場合は、現在のストリーム書き込みサポートするかどうかを示す値を取得します

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

解説解説
使用例使用例

CanWrite プロパティ使用例次に示します

Imports System
Imports System.IO

Class TestRW    

    Public Shared Sub Main()
        Dim fs As New FileStream("MyFile.txt",
 FileMode.OpenOrCreate, _
           FileAccess.Write)
        If fs.CanRead And fs.CanWrite Then
            Console.WriteLine("MyFile.txt can be both written
 to and read from.")
        Else
            If fs.CanWrite Then
                Console.WriteLine("MyFile.txt is writable.")
            End If
        End If
    End Sub
End Class

'This code outputs "MyFile.txt is writable."
'To get the output message "MyFile.txt can be both written to and
 read from.",
'change the FileAccess parameter to ReadWrite in the FileStream constructor.
using System;
using System.IO;

class TestRW 
{
  public static void Main(String[]
 args)
  { 
    FileStream fs = new FileStream("MyFile.txt", FileMode.OpenOrCreate
,
       FileAccess.Write);
    if (fs.CanRead && fs.CanWrite) {
        Console.WriteLine("MyFile.txt can be both written to and read from.");
    }
    else if (fs.CanWrite) {
        Console.WriteLine("MyFile.txt is writable.");
    }
  }
}
//This code outputs "MyFile.txt is writable."
//To get the output message "MyFile.txt can be both written to
 and read from.",
//change the FileAccess parameter to ReadWrite in the FileStream constructor.
using namespace System;
using namespace System::IO;
int main()
{
   FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Write
 );
   if ( fs->CanRead && fs->CanWrite )
   {
      Console::WriteLine( "MyFile.txt can be both written to and read from."
 );
   }
   else
   if ( fs->CanWrite )
   {
      Console::WriteLine( "MyFile.txt is writable." );
   }
}

//This code outputs "MyFile.txt is writable."
//To get the output message "MyFile.txt can be both written to
 and read from.",
//change the FileAccess parameter to ReadWrite in the FileStream constructor.
import System.*;
import System.IO.*;

class TestRW
{
    public static void main(String[]
 args)
    {
        FileStream fs = new FileStream("MyFile.txt",
 
            FileMode.OpenOrCreate, FileAccess.Write);
        if (fs.get_CanRead() && fs.get_CanWrite()) {
            Console.WriteLine(
                "MyFile.txt can be both written to and read from.");
        }
        else {
            if (fs.get_CanWrite()) {
                Console.WriteLine("MyFile.txt is writable.");
            }
        }
    } //main
} //TestRW

//This code outputs "MyFile.txt is writable."
//To get the output message "MyFile.txt can be both written to
 and read from.",
//change the FileAccess parameter to ReadWrite in the FileStream constructor.
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からStream.CanWrite プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からStream.CanWrite プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からStream.CanWrite プロパティを検索

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

辞書ショートカット

すべての辞書の索引

「Stream.CanWrite プロパティ」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS