FileStream.Name Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u het absolute pad op van het bestand dat in het FileStreambestand is geopend.
public:
property System::String ^ Name { System::String ^ get(); };
public:
virtual property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
public virtual string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String
Public Overridable ReadOnly Property Name As String
Waarde van eigenschap
Een tekenreeks die het absolute pad van het bestand is.
Voorbeelden
Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de FileStream(String, FileMode, FileAccess, FileShare, Int32, Boolean) constructor.
static void EndReadCallback(IAsyncResult asyncResult)
{
State tempState = (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();
}
let endReadCallback (asyncResult: IAsyncResult) =
let tempState = asyncResult.AsyncState :?> State
let readCount = tempState.FStream.EndRead asyncResult
let mutable i = 0
let mutable errored = false
while i < readCount do
if tempState.ReadArray[i] <> tempState.WriteArray[i] then
printfn "Error writing data."
tempState.FStream.Close()
errored <- true
i <- readCount
i <- i + 1
printfn $"The data was written to {tempState.FStream.Name} and verified."
tempState.FStream.Close()
// Signal the main thread that the verification is finished.
tempState.ManualEvent.Set() |> ignore
Private Shared Sub EndReadCallback(asyncResult As IAsyncResult)
Dim tempState As State = _
DirectCast(asyncResult.AsyncState, State)
Dim readCount As Integer = _
tempState.FStream.EndRead(asyncResult)
Dim i As Integer = 0
While(i < readCount)
If(tempState.ReadArray(i) <> tempState.WriteArray(i))
Console.WriteLine("Error writing data.")
tempState.FStream.Close()
Return
End If
i += 1
End While
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()
End Sub
Opmerkingen
Als het absolute pad niet bekend is, retourneert deze eigenschap een tekenreeks die vergelijkbaar is met [Onbekend].
Zie Algemene I/O-taken voor een lijst met algemene bestands- en mapbewerkingen.