mscorlib(4.0.0.0) API with additions
System.Resources.ResourceWriter Class Reference

Writes resources in the system-default format to an output file or an output stream. This class cannot be inherited. More...

Inheritance diagram for System.Resources.ResourceWriter:
[legend]
Collaboration diagram for System.Resources.ResourceWriter:
[legend]

Public Member Functions

 ResourceWriter (string fileName)
 Initializes a new instance of the T:System.Resources.ResourceWriter class that writes the resources to the specified file. More...
 
 ResourceWriter (Stream stream)
 Initializes a new instance of the T:System.Resources.ResourceWriter class that writes the resources to the provided stream. More...
 
void AddResource (string name, string value)
 Adds a string resource to the list of resources to be written. More...
 
void AddResource (string name, object value)
 Adds a named resource specified as an object to the list of resources to be written. More...
 
void AddResource (string name, Stream value)
 Adds a named resource specified as a stream to the list of resources to be written. More...
 
void AddResource (string name, Stream value, bool closeAfterWrite)
 Adds a named resource specified as a stream to the list of resources to be written, and specifies whether the stream should be closed after the M:System.Resources.ResourceWriter.Generate method is called. More...
 
void AddResource (string name, byte[] value)
 Adds a named resource specified as a byte array to the list of resources to be written. More...
 
void AddResourceData (string name, string typeName, byte[] serializedData)
 Adds a unit of data as a resource to the list of resources to be written. More...
 
void Close ()
 Saves the resources to the output stream and then closes it. More...
 
void Dispose ()
 Allows users to close the resource file or stream, explicitly releasing resources. More...
 
void Generate ()
 Saves all resources to the output stream in the system default format. More...
 

Properties

Func< Type, string > TypeNameConverter [get, set]
 Gets or sets a delegate that enables resource assemblies to be written that target versions of the .NET Framework prior to the .NET Framework 4 by using qualified assembly names. More...
 

Detailed Description

Writes resources in the system-default format to an output file or an output stream. This class cannot be inherited.

Definition at line 16 of file ResourceWriter.cs.

Constructor & Destructor Documentation

◆ ResourceWriter() [1/2]

System.Resources.ResourceWriter.ResourceWriter ( string  fileName)

Initializes a new instance of the T:System.Resources.ResourceWriter class that writes the resources to the specified file.

Parameters
fileNameThe output file name.
Exceptions
T:System.ArgumentNullExceptionThe fileName parameter is null.

Definition at line 79 of file ResourceWriter.cs.

◆ ResourceWriter() [2/2]

System.Resources.ResourceWriter.ResourceWriter ( Stream  stream)

Initializes a new instance of the T:System.Resources.ResourceWriter class that writes the resources to the provided stream.

Parameters
streamThe output stream.
Exceptions
T:System.ArgumentExceptionThe stream parameter is not writable.
T:System.ArgumentNullExceptionThe stream parameter is null.

Definition at line 94 of file ResourceWriter.cs.

Member Function Documentation

◆ AddResource() [1/5]

void System.Resources.ResourceWriter.AddResource ( string  name,
string  value 
)

Adds a string resource to the list of resources to be written.

Parameters
nameThe name of the resource.
valueThe value of the resource.
Exceptions
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this ResourceWriter.
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed and its hash table is unavailable.

Implements System.Resources.IResourceWriter.

Definition at line 116 of file ResourceWriter.cs.

◆ AddResource() [2/5]

void System.Resources.ResourceWriter.AddResource ( string  name,
object  value 
)

Adds a named resource specified as an object to the list of resources to be written.

Parameters
nameThe name of the resource.
valueThe value of the resource.
Exceptions
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this T:System.Resources.ResourceWriter.
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed and its hash table is unavailable.

Implements System.Resources.IResourceWriter.

Definition at line 137 of file ResourceWriter.cs.

◆ AddResource() [3/5]

void System.Resources.ResourceWriter.AddResource ( string  name,
Stream  value 
)

Adds a named resource specified as a stream to the list of resources to be written.

Parameters
nameThe name of the resource to add.
valueThe value of the resource to add. The resource must support the P:System.IO.Stream.Length property.
Exceptions
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this T:System.Resources.ResourceWriter.-or-The stream does not support the P:System.IO.Stream.Length property.
T:System.ArgumentNullExceptionname or value is null.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed.

Definition at line 164 of file ResourceWriter.cs.

◆ AddResource() [4/5]

void System.Resources.ResourceWriter.AddResource ( string  name,
Stream  value,
bool  closeAfterWrite 
)

Adds a named resource specified as a stream to the list of resources to be written, and specifies whether the stream should be closed after the M:System.Resources.ResourceWriter.Generate method is called.

Parameters
nameThe name of the resource to add.
valueThe value of the resource to add. The resource must support the P:System.IO.Stream.Length property.
closeAfterWritetrue to close the stream after the M:System.Resources.ResourceWriter.Generate method is called; otherwise, false.
Exceptions
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this T:System.Resources.ResourceWriter.-or-The stream does not support the P:System.IO.Stream.Length property.
T:System.ArgumentNullExceptionname or value is null.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed.

Definition at line 187 of file ResourceWriter.cs.

◆ AddResource() [5/5]

void System.Resources.ResourceWriter.AddResource ( string  name,
byte []  value 
)

Adds a named resource specified as a byte array to the list of resources to be written.

Parameters
nameThe name of the resource.
valueValue of the resource as an 8-bit unsigned integer array.
Exceptions
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this T:System.Resources.ResourceWriter.
T:System.ArgumentNullExceptionThe name parameter is null.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed and its hash table is unavailable.

Implements System.Resources.IResourceWriter.

Definition at line 223 of file ResourceWriter.cs.

◆ AddResourceData()

void System.Resources.ResourceWriter.AddResourceData ( string  name,
string  typeName,
byte []  serializedData 
)

Adds a unit of data as a resource to the list of resources to be written.

Parameters
nameA name that identifies the resource that contains the added data.
typeNameThe type name of the added data. For more information, see the Remarks section.
serializedDataA byte array that contains the binary representation of the added data.
Exceptions
T:System.ArgumentNullExceptionname , typeName , or serializedData is null.
T:System.ArgumentExceptionname (or a name that varies only by capitalization) has already been added to this T:System.Resources.ResourceWriter object.
T:System.InvalidOperationExceptionThe current T:System.Resources.ResourceWriter object is not initialized. The probable cause is that the T:System.Resources.ResourceWriter object is closed.

Definition at line 246 of file ResourceWriter.cs.

◆ Close()

void System.Resources.ResourceWriter.Close ( )

Saves the resources to the output stream and then closes it.

Exceptions
T:System.IO.IOExceptionAn I/O error has occurred.
T:System.Runtime.Serialization.SerializationExceptionAn error has occurred during serialization of the object.

Implements System.Resources.IResourceWriter.

Definition at line 275 of file ResourceWriter.cs.

◆ Dispose()

void System.Resources.ResourceWriter.Dispose ( )

Allows users to close the resource file or stream, explicitly releasing resources.

Exceptions
T:System.IO.IOExceptionAn I/O error has occurred.
T:System.Runtime.Serialization.SerializationExceptionAn error has occurred during serialization of the object.

Implements System.IDisposable.

Definition at line 300 of file ResourceWriter.cs.

◆ Generate()

void System.Resources.ResourceWriter.Generate ( )

Saves all resources to the output stream in the system default format.

Exceptions
T:System.IO.IOExceptionAn I/O error occurred.
T:System.Runtime.Serialization.SerializationExceptionAn error occurred during serialization of the object.
T:System.InvalidOperationExceptionThis T:System.Resources.ResourceWriter has been closed and its hash table is unavailable.

Implements System.Resources.IResourceWriter.

Definition at line 310 of file ResourceWriter.cs.

Property Documentation

◆ TypeNameConverter

Func<Type, string> System.Resources.ResourceWriter.TypeNameConverter
getset

Gets or sets a delegate that enables resource assemblies to be written that target versions of the .NET Framework prior to the .NET Framework 4 by using qualified assembly names.

Returns
The type that is encapsulated by the delegate.

Definition at line 65 of file ResourceWriter.cs.


The documentation for this class was generated from the following file: