ResXResourceWriter Class
Writes resources in an XML resource (.resx) file or an output stream.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() | ResXResourceWriter(Stream^) | Initializes a new instance of the ResXResourceWriter class that writes the resources to the specified stream object. |
![]() | ResXResourceWriter(Stream^, Func<Type^, String^>^) | Initializes a new instance of the ResXResourceWriter class that writes the resources to a specified stream object and sets a converter delegate. This delegate enables resource assemblies to be written that target versions of the .NET Framework before the .NET Framework 4 by using qualified assembly names. |
![]() | ResXResourceWriter(String^) | Initializes a new instance of the ResXResourceWriter class that writes the resources to the specified file. |
![]() | ResXResourceWriter(String^, Func<Type^, String^>^) | Initializes a new instance of the ResXResourceWriter class that writes the resources to a specified file and sets a delegate that enables resource assemblies to be written that target versions of the .NET Framework before the .NET Framework 4 by using qualified assembly names. |
![]() | ResXResourceWriter(TextWriter^) | Initializes a new instance of the ResXResourceWriter class that writes to the specified TextWriter object. |
![]() | ResXResourceWriter(TextWriter^, Func<Type^, String^>^) | Initializes a new instance of the ResXResourceWriter class that writes the resources to a specified TextWriter object and sets a delegate that enables resource assemblies to be written that target versions of the .NET Framework before the .NET Framework 4 by using qualified assembly names. |
| Name | Description | |
|---|---|---|
![]() | BasePath | Gets or sets the base path for the relative file path specified in a ResXFileRef object. |
| Name | Description | |
|---|---|---|
![]() | AddAlias(String^, AssemblyName^) | Adds the specified alias to a list of aliases. |
![]() | AddMetadata(String^, array<Byte>^) | Adds a design-time property whose value is specifed as a byte array to the list of resources to write. |
![]() | AddMetadata(String^, Object^) | Adds a design-time property whose value is specified as an object to the list of resources to write. |
![]() | AddMetadata(String^, String^) | Adds a design-time property whose value is specified as a string to the list of resources to write. |
![]() | AddResource(ResXDataNode^) | Adds a named resource specified in a ResXDataNode object to the list of resources to write. |
![]() | AddResource(String^, array<Byte>^) | Adds a named resource specified as a byte array to the list of resources to write. |
![]() | AddResource(String^, Object^) | Adds a named resource specified as an object to the list of resources to write. |
![]() | AddResource(String^, String^) | Adds a string resource to the resources. |
![]() | Close() | Releases all resources used by the ResXResourceWriter. |
![]() | Dispose() | Releases all resources used by the ResXResourceWriter. |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the ResXResourceWriter and optionally releases the managed resources. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | This member overrides the Finalize method. (Overrides Object::Finalize().) |
![]() | Generate() | Writes all resources added by the AddResource method to the output file or stream. |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | BinSerializedObjectMimeType | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the default content type for a binary object. This field is read-only. |
![]() ![]() | ByteArraySerializedObjectMimeType | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the default content type for a byte array object. This field is read-only. |
![]() ![]() | DefaultSerializedObjectMimeType | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the default content type for an object. This field is read-only. |
![]() ![]() | ResMimeType | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the content type of an XML resource. This field is read-only. |
![]() ![]() | ResourceSchema | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the schema to use in writing the XML file. This field is read-only. |
![]() ![]() | SoapSerializedObjectMimeType | This API supports the product infrastructure and is not intended to be used directly from your code. Specifies the content type for a SOAP object. This field is read-only. |
![]() ![]() | Version | Specifies the version of the schema that the XML output conforms to. This field is read-only. |
The ResXResourceWriter writes resources in XML format. To write a binary resource file, use ResourceWriter.
Resources are specified as name/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, ResXResourceWriter does not allow a.resx file to have names that vary only by case.
To create a.resx file, create a ResXResourceWriter 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 Generate the file if required.
The resources are not necessarily written in the same order they were added.
For more information on the format of a.resx file, see Working with .resx Files Programmatically.
Note |
|---|
This class contains a link demand and an inheritance demand at the class level that applies to all members. A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. |
The following example creates a .resx file named CarResources.resx that stores six strings, an icon, and two application-defined objects (two Automobile objects). Note that the Automobile class, which is defined and instantiated in the example, is tagged with the SerializableAttribute attribute.
for full trust for the immediate caller. This member cannot be used by partially trusted code.
for full trust for inheritors. This member cannot be inherited by partially trusted code.
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.





