FileStream::Name Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the name of the FileStream that was passed to the constructor.

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)

public:
property String^ Name {
	String^ get();
}

Property Value

Type: System::String^

A string that is the name of the FileStream.

For a list of common file and directory operations, see Common I-O Tasks.

This code example is part of a larger example provided for the FileStream(String^, FileMode, FileAccess, FileShare, Int32, Boolean) constructor.

   static void EndReadCallback( IAsyncResult^ asyncResult )
   {
      State^ tempState = dynamic_cast<State^>(asyncResult->AsyncState);
      int readCount = tempState->FStream->EndRead( asyncResult );
      int i = 0;
      while ( i < readCount )
      {
         if ( tempState->ReadArray[ i ] != tempState->WriteArray[ i++ ] )
         {
            Console::WriteLine( "Error writing data." );
            tempState->FStream->Close();
            return;
         }
      }

      Console::WriteLine( "The data was written to {0} "
      "and verified.", tempState->FStream->Name );
      tempState->FStream->Close();

      // Signal the main thread that the verification is finished.
      tempState->ManualEvent->Set();
   }


public:

FileIOPermission

for access to the path. Associated enumeration: FileIOPermissionAccess::PathDiscovery

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: