ResourceWriter Constructors

Definitie

Initialiseert een nieuw exemplaar van de ResourceWriter klasse.

Overloads

Name Description
ResourceWriter(Stream)

Initialiseert een nieuw exemplaar van de ResourceWriter klasse waarmee de resources naar de opgegeven stream worden geschreven.

ResourceWriter(String)

Initialiseert een nieuw exemplaar van de ResourceWriter klasse waarmee de resources naar het opgegeven bestand worden geschreven.

ResourceWriter(Stream)

Initialiseert een nieuw exemplaar van de ResourceWriter klasse waarmee de resources naar de opgegeven stream worden geschreven.

public:
 ResourceWriter(System::IO::Stream ^ stream);
public ResourceWriter(System.IO.Stream stream);
new System.Resources.ResourceWriter : System.IO.Stream -> System.Resources.ResourceWriter
Public Sub New (stream As Stream)

Parameters

stream
Stream

De uitvoerstroom.

Uitzonderingen

De stream parameter kan niet worden geschreven.

De stream parameter is null.

Voorbeelden

In het volgende codevoorbeeld wordt een nieuw exemplaar van de ResourceWriter klasse gedefinieerd die naar een opgegeven stream schrijft. De code voegt resources toe aan de schrijver en schrijft de resources naar de stream.

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

Zie ook

Van toepassing op

ResourceWriter(String)

Initialiseert een nieuw exemplaar van de ResourceWriter klasse waarmee de resources naar het opgegeven bestand worden geschreven.

public:
 ResourceWriter(System::String ^ fileName);
public ResourceWriter(string fileName);
new System.Resources.ResourceWriter : string -> System.Resources.ResourceWriter
Public Sub New (fileName As String)

Parameters

fileName
String

De naam van het uitvoerbestand.

Uitzonderingen

De fileName parameter is null.

Voorbeelden

In het volgende codevoorbeeld wordt een nieuw exemplaar van de ResourceWriter klasse gedefinieerd dat naar een opgegeven bestand wordt geschreven. De code voegt resources toe aan de schrijver en schrijft de resources naar het bestand.

using System;
using System.Resources;

public class WriteResources {
   public static void Main(string[] args) {

      // Creates a resource writer.
      IResourceWriter writer = new ResourceWriter("myResources.resources");

      // Adds resources to the resource writer.
      writer.AddResource("String 1", "First String");

      writer.AddResource("String 2", "Second String");

      writer.AddResource("String 3", "Third String");

      // Writes the resources to the file or stream, and closes it.
      writer.Close();
   }
}
Imports System.Resources

Public Class WriteResources
    
    Public Shared Sub Main()
        
        ' Creates a resource writer.
        Dim writer As New ResourceWriter("myResources.resources")
        
        ' Adds resources to the resource writer.
        writer.AddResource("String 1", "First String")
        
        writer.AddResource("String 2", "Second String")
        
        writer.AddResource("String 3", "Third String")
        
        ' Writes the resources to the file or stream, and closes it.
        writer.Close()
    End Sub
End Class

Zie ook

Van toepassing op