ResXResourceWriter::AddResource Method (String^, Object^)
Adds a named resource specified as an object to the list of resources to write.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- name
-
Type:
System::String^
The name of the resource.
- value
-
Type:
System::Object^
The value of the resource.
The resource is not written until Generate is called. The resource that was added must be serializable.
If the resource being added is a string, it is written as a string; otherwise, the resource is serialized and stored in a binary format.
The following example creates a .resx file named CarResources.resx that stores six strings, an icon, and two application-defined objects (two Automobile objects). To store the icon and the Automobile objects, it calls the AddResource(String^, Object^) method. Note that the Automobile class, which is defined and instantiated in the example, is tagged with the SerializableAttribute attribute.
Available since 1.1