ResourceWriter Class
Assembly: mscorlib (in mscorlib.dll)
'Declaration <ComVisibleAttribute(True)> _ Public NotInheritable Class ResourceWriter Implements IResourceWriter, IDisposable 'Usage Dim instance As ResourceWriter
/** @attribute ComVisibleAttribute(true) */ public final class ResourceWriter implements IResourceWriter, IDisposable
ComVisibleAttribute(true) public final class ResourceWriter implements IResourceWriter, IDisposable
ResourceWriter provides a default implementation of the IResourceWriter interface.
Resources are specified as name and value pairs using the AddResource method. Resource names are case-sensitive when used for lookups, but to more easily support authoring tools and help eliminate bugs, ResourceWriter will not allow a .resources file to have names that vary only by case.
To create a resources file, create a ResourceWriter with a unique file name, call AddResource at least once, call Generate to write the resources file to disk, and then call Close to close the file. Calling Close will implicitly call Generate if you do not explicitly call Generate.
The resources will not necessarily be written in the same order they were added.
The following example writes several strings into the myResources.resources file.
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
import System.*;
import 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();
} //main
} //WriteResources
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.