|
Este artículo proviene de un motor de traducción automática. Mueva el puntero sobre las frases del artículo para ver el texto original. Más información.
|
Traducción
Original
|
FileStream (Clase)
Espacio de nombres: System.IO
Ensamblado: mscorlib (en mscorlib.dll)
El tipo FileStream expone los siguientes miembros.
| Nombre | Descripción | |
|---|---|---|
![]() | FileStream(IntPtr, FileAccess) | Obsoleto. |
![]() | FileStream(SafeFileHandle, FileAccess) | |
![]() ![]() | FileStream(String, FileMode) | |
![]() | FileStream(IntPtr, FileAccess, Boolean) | Obsoleto. |
![]() | FileStream(SafeFileHandle, FileAccess, Int32) | |
![]() ![]() | FileStream(String, FileMode, FileAccess) | |
![]() | FileStream(IntPtr, FileAccess, Boolean, Int32) | Obsoleto. |
![]() | FileStream(SafeFileHandle, FileAccess, Int32, Boolean) | |
![]() ![]() | FileStream(String, FileMode, FileAccess, FileShare) | |
![]() | FileStream(IntPtr, FileAccess, Boolean, Int32, Boolean) | Obsoleto. |
![]() ![]() | FileStream(String, FileMode, FileAccess, FileShare, Int32) | |
![]() ![]() | FileStream(String, FileMode, FileAccess, FileShare, Int32, Boolean) | |
![]() | FileStream(String, FileMode, FileAccess, FileShare, Int32, FileOptions) | |
![]() | FileStream(String, FileMode, FileSystemRights, FileShare, Int32, FileOptions) | |
![]() | FileStream(String, FileMode, FileSystemRights, FileShare, Int32, FileOptions, FileSecurity) |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | CanRead | |
![]() ![]() | CanSeek | |
![]() ![]() | CanTimeout | |
![]() ![]() | CanWrite | |
![]() | Handle | Obsoleto. |
![]() ![]() | IsAsync | |
![]() ![]() | Length | |
![]() ![]() | Name | |
![]() ![]() | Position | |
![]() ![]() | ReadTimeout | |
![]() | SafeFileHandle | |
![]() ![]() | WriteTimeout |
| Nombre | Descripción | |
|---|---|---|
![]() ![]() | BeginRead | En XNA Framework 3.0, este miembro se hereda de Stream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object). |
![]() ![]() | BeginWrite | En XNA Framework 3.0, este miembro se hereda de Stream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object). |
![]() ![]() | Close | |
![]() | CopyTo(Stream) | |
![]() | CopyTo(Stream, Int32) | |
![]() | CopyToAsync(Stream) | |
![]() | CopyToAsync(Stream, Int32) | |
![]() | CopyToAsync(Stream, Int32, CancellationToken) | |
![]() | CreateObjRef | |
![]() ![]() | CreateWaitHandle | Obsoleto. |
![]() ![]() | Dispose() | |
![]() ![]() | Dispose(Boolean) | |
![]() ![]() | EndRead | En XNA Framework 3.0, este miembro se hereda de Stream.EndRead(IAsyncResult). |
![]() ![]() | EndWrite | En XNA Framework 3.0, este miembro se hereda de Stream.EndWrite(IAsyncResult). |
![]() ![]() | Equals(Object) | |
![]() ![]() | Finalize | |
![]() ![]() | Flush() | |
![]() | Flush(Boolean) | |
![]() | FlushAsync() | |
![]() | FlushAsync(CancellationToken) | |
![]() | GetAccessControl | |
![]() ![]() | GetHashCode | |
![]() | GetLifetimeService | |
![]() ![]() | GetType | |
![]() | InitializeLifetimeService | |
![]() | Lock | |
![]() ![]() | MemberwiseClone() | |
![]() | MemberwiseClone(Boolean) | |
![]() | ObjectInvariant | Infraestructura. Obsoleto. |
![]() ![]() | Read | |
![]() | ReadAsync(Byte[], Int32, Int32) | |
![]() | ReadAsync(Byte[], Int32, Int32, CancellationToken) | |
![]() ![]() | ReadByte | |
![]() ![]() | Seek | |
![]() | SetAccessControl | |
![]() ![]() | SetLength | |
![]() ![]() | ToString | |
![]() | Unlock | |
![]() ![]() | Write | |
![]() | WriteAsync(Byte[], Int32, Int32) | |
![]() | WriteAsync(Byte[], Int32, Int32, CancellationToken) | |
![]() ![]() | WriteByte |
| Nombre | Descripción | |
|---|---|---|
![]() | AsInputStream | |
![]() | AsOutputStream |
Nota |
|---|
Detección de cambios de la posición de la secuencia
using System; using System.IO; using System.Text; class Test { public static void Main() { string path = @"c:\temp\MyTest.txt"; // Delete the file if it exists. if (File.Exists(path)) { File.Delete(path); } //Create the file. using (FileStream fs = File.Create(path)) { AddText(fs, "This is some text"); AddText(fs, "This is some more text,"); AddText(fs, "\r\nand this is on a new line"); AddText(fs, "\r\n\r\nThe following is a subset of characters:\r\n"); for (int i=1;i < 120;i++) { AddText(fs, Convert.ToChar(i).ToString()); } } //Open the stream and read it back. using (FileStream fs = File.OpenRead(path)) { byte[] b = new byte[1024]; UTF8Encoding temp = new UTF8Encoding(true); while (fs.Read(b,0,b.Length) > 0) { Console.WriteLine(temp.GetString(b)); } } } private static void AddText(FileStream fs, string value) { byte[] info = new UTF8Encoding(true).GetBytes(value); fs.Write(info, 0, info.Length); } }
using System; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.IO; namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private async void Button_Click(object sender, RoutedEventArgs e) { UnicodeEncoding uniencoding = new UnicodeEncoding(); string filename = @"c:\Users\exampleuser\Documents\userinputlog.txt"; byte[] result = uniencoding.GetBytes(UserInput.Text); using (FileStream SourceStream = File.Open(filename, FileMode.OpenOrCreate)) { SourceStream.Seek(0, SeekOrigin.End); await SourceStream.WriteAsync(result, 0, result.Length); } } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (no se admite el rol Server Core), Windows Server 2008 R2 (se admite el rol Server Core con SP1 o versiones posteriores; no se admite Itanium)
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
