ResourceWriter::AddResource Method (String^, Stream^)

.NET Framework (current version)
 

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

Namespace:   System.Resources
Assembly:  mscorlib (in mscorlib.dll)

public:
void AddResource(
	String^ name,
	Stream^ value
)

Parameters

name
Type: System::String^

The name of the resource to add.

value
Type: System.IO::Stream^

The value of the resource to add. The resource must support the Stream::Length property.

Exception Condition
ArgumentException

name (or a name that varies only by capitalization) has already been added to this ResourceWriter.

-or-

The stream does not support the Stream::Length property.

ArgumentNullException

name or value is null.

InvalidOperationException

This ResourceWriter has been closed.

You can specify any stream that supports the Stream::Length property for value.

You can retrieve the resources written by the AddResource(String^, Stream^) method by calling the ResourceManager::GetStream method.

The following example uses the AddResource(String^, Stream^) method to add a graphics image that has been saved to a MemoryStream object to a ResourceWriter object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0
Return to top
Show: