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

Stream.CanRead プロパティ

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

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

解説解説
使用例使用例

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

Imports System
Imports System.IO

Class TestRW

    Public Shared Sub Main()
        Dim fs As New FileStream("MyFile.txt",
 FileMode.OpenOrCreate, FileAccess.Read)
        If fs.CanRead And fs.CanWrite Then
            Console.WriteLine("MyFile.txt can be both written
 to and read from.")
        Else
            If fs.CanRead Then
                Console.WriteLine("MyFile.txt is not writable.")
            End If
        End If
    End Sub
End Class
using System;
using System.IO;
 
class TestRW 
{
    public static void Main(String[]
 args)
    {
        FileStream fs = new FileStream("MyFile.txt",
 FileMode.OpenOrCreate, FileAccess.Read);
        if (fs.CanRead && fs.CanWrite)
        {
            Console.WriteLine("MyFile.txt can be both written to and read from.");
        }
        else if (fs.CanRead)
        {
            Console.WriteLine("MyFile.txt is not writable.");
        }
    }
}
using namespace System;
using namespace System::IO;
int main( void )
{
   FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Read
 );
   if ( fs->CanRead && fs->CanWrite )
   {
      Console::WriteLine( "MyFile.txt can be both written to and read from."
 );
   }
   else
   {
      Console::WriteLine( "MyFile.txt is not writable" );
   }

   return 0;
}

import System.*;
import System.IO.*;

class TestRW
{
    public static void main(String[]
 args)
    {
        FileStream fs = new FileStream("MyFile.txt",
 
            FileMode.OpenOrCreate, FileAccess.Read);
        if (fs.get_CanRead() && fs.get_CanWrite()) {
            Console.WriteLine("MyFile.txt can be both written to " 
                + "and read from.");
        }
        else {
            if (fs.get_CanRead()) {
                Console.WriteLine("MyFile.txt is not writable.");
            }
        }
    } //main
} //TestRW
 import System;
 import System.IO;
 
class TestRW 
{
   public static function
 Main() : void 
   {
 
         var fs : FileStream = new FileStream("MyFile.txt",
 FileMode.OpenOrCreate, FileAccess.Read);
         if (fs.CanRead && fs.CanWrite)
         {
            Console.WriteLine("MyFile.txt can be both written to and read from.");
         }
         else if (fs.CanRead)
         {
            Console.WriteLine("MyFile.txt is not writable.");
      }
   }
}
TestRW.Main();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2024 GRAS Group, Inc.RSS