System.Resources.IResourceWriter Interface

Assembly: Mscorlib.dll
Namespace: System.Resources
Summary
Provides functionality to write resources to an output file or stream.
C# Syntax:
public interface IResourceWriter : IDisposable
Remarks
Use resource writers to write resources in a particular file format. Generally, users will create a resource writer, call IResourceWriter.AddResource to add resources, and then call either IResourceWriter.Generate or IResourceWriter.Close to close the resource file.

See the the conceptual topic at MSDN: designingglobalapplications for details on the default resource file format.

See also:
System.Resources Namespace | IDisposable | MSDN: designingglobalapplications

System.Resources.IResourceWriter Member List:

Public Methods
AddResource Overloaded:
AddResource(string name, byte[] value)

Adds an 8-bit unsigned integer array as a named resource to the list of resources to be written.
AddResource Overloaded:
AddResource(string name, object value)

Adds a named resource of type Object to the list of resources to be written.
AddResource Overloaded:
AddResource(string name, string value)

Adds a named resource of type String to the list of resources to be written.
Close Closes the underlying resource file or stream, ensuring all the data has been written to the file.
Generate Writes all the resources added by the IResourceWriter.AddResource method to the output file or stream.

Hierarchy:


System.Resources.IResourceWriter Member Details

Overloaded Method: AddResource(
   string name,
   byte[] value
)
Summary
Adds an 8-bit unsigned integer array as a named resource to the list of resources to be written.
C# Syntax:
void AddResource(
   string name,
   byte[] value
);
Parameters:

name

Name of a resource.

value

Value of a resource as an 8-bit unsigned integer array.

Exceptions
Exception Type Condition
ArgumentNullException The name parameter is null.
Remarks
The resources are not written until IResourceWriter.Generate is called.

Return to top


Overloaded Method: AddResource(
   string name,
   object value
)
Summary
Adds a named resource of type Object to the list of resources to be written.
C# Syntax:
void AddResource(
   string name,
   object value
);
Parameters:

name

The name of the resource.

value

The value of the resource.

Exceptions
Exception Type Condition
ArgumentNullException The name parameter is null.
Remarks
The resource is not written until IResourceWriter.Generate is called.

Note value might need to be serializable, so you might have to provide a type converter, depending on which resource writer is used.

Return to top


Overloaded Method: AddResource(
   string name,
   string value
)
Summary
Adds a named resource of type String to the list of resources to be written.
C# Syntax:
void AddResource(
   string name,
   string value
);
Parameters:

name

The name of the resource.

value

The value of the resource.

Exceptions
Exception Type Condition
ArgumentException The name parameter is null.
Remarks
The resource is not written until IResourceWriter.Generate is called.

Return to top


Method: Close()
Summary
Closes the underlying resource file or stream, ensuring all the data has been written to the file.
C# Syntax:
void Close();
Remarks
If necessary, IResourceWriter.Close will call IResourceWriter.Generate to output the resources to the underlying file or stream before closing it.

Return to top


Method: Generate()
Summary
Writes all the resources added by the IResourceWriter.AddResource method to the output file or stream.
C# Syntax:
void Generate();
Remarks
IResourceWriter.Generate does not close the output file or output stream. Instead, consider calling IResourceWriter.Close. IResourceWriter.Generate is useful when you need to create a resource file but you don't want to close the output stream. IResourceWriter.Generate can only be called once. After calling IResourceWriter.Generate, all IResourceWriter methods other than IResourceWriter.Close will throw an exception.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.