ResourceWriter.Close Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Guarda los recursos en el flujo de salida y, a continuación, lo cierra.
public:
virtual void Close();
public void Close ();
abstract member Close : unit -> unit
override this.Close : unit -> unit
Public Sub Close ()
Implementaciones
Excepciones
Error de E/S.
Se ha producido un error durante la serialización del objeto.
Ejemplos
En el ejemplo siguiente se usa el Close método para escribir todos los objetos de recursos de una ResourceWriter clase en el flujo de salida. A continuación, el código cierra el sistema de escritura.
using namespace System;
using namespace System::Resources;
using namespace System::IO;
int main()
{
// Create a file stream to encapsulate items.resources.
FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write );
// Open a resource writer to write from the stream.
IResourceWriter^ writer = gcnew ResourceWriter( fs );
// Add resources to the resource writer.
writer->AddResource( "String 1", "First String" );
writer->AddResource( "String 2", "Second String" );
writer->AddResource( "String 3", "Third String" );
// Write the resources to the stream, and close it.
writer->Close();
}
using System;
using System.Resources;
using System.IO;
public class WriteResources
{
public static void Main(string[] args)
{
// Create a file stream to encapsulate items.resources.
FileStream fs = new FileStream("items.resources",
FileMode.OpenOrCreate,FileAccess.Write);
// Open a resource writer to write from the stream.
IResourceWriter writer = new ResourceWriter(fs);
// Add resources to the resource writer.
writer.AddResource("String 1", "First String");
writer.AddResource("String 2", "Second String");
writer.AddResource("String 3", "Third String");
// Write the resources to the stream, and close it.
writer.Close();
}
}
Imports System.Resources
Imports System.IO
Public Class WriteResources
Public Shared Sub Main(args() As String)
' Create a file stream to encapsulate items.resources.
Dim fs As New FileStream("items.resources", _
FileMode.OpenOrCreate, FileAccess.Write)
' Open a resource writer to write from the stream.
Dim writer = New ResourceWriter(fs)
' Add resources to the resource writer.
writer.AddResource("String 1", "First String")
writer.AddResource("String 2", "Second String")
writer.AddResource("String 3", "Third String")
' Write the resources to the stream, and close it.
writer.Close()
End Sub
End Class
Comentarios
Generate si es necesario, llama implícitamente a Close.