Export (0) Print
Expand All

ResourceWriter Constructor

.NET Framework 1.1

Initializes a new instance of the ResourceWriter class.

Overload List

Initializes a new instance of the ResourceWriter class that writes the resources to the provided stream.

[Visual Basic] Public Sub New(Stream)
[C#] public ResourceWriter(Stream);
[C++] public: ResourceWriter(Stream*);
[JScript] public function ResourceWriter(Stream);

Initializes a new instance of the ResourceWriter class that writes the resources to the specified file.

[Visual Basic] Public Sub New(String)
[C#] public ResourceWriter(string);
[C++] public: ResourceWriter(String*);
[JScript] public function ResourceWriter(String);

Example

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the ResourceWriter constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Imports System
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

[C#] 
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();
   }
}

[C++] 
using namespace System;
using namespace System::Resources;


int main() {

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

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

    writer->AddResource(S"String 2", S"Second String");

    writer->AddResource(S"String 3", S"Third String");

    // Writes the resources to the file or stream, and closes it.
    writer->Close();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

ResourceWriter Class | ResourceWriter Members | System.Resources Namespace

Show:
© 2014 Microsoft