ResXResourceWriter Class
Writes resources in an XML resource (.resx) file or an output stream.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The ResXResourceWriter type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ResXResourceWriter(Stream) | Initializes a new instance of the ResXResourceWriter class that writes the resources to the specified stream object. |
![]() | ResXResourceWriter(String) | Initializes a new instance of the ResXResourceWriter class that writes the resources to the specified file. |
![]() | ResXResourceWriter(TextWriter) | Initializes a new instance of the ResXResourceWriter class that writes to the specified TextWriter 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 version 4 by using qualified assembly names. |
![]() | 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 version 4 by using qualified assembly names. |
![]() | 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 version 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 | 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 a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | BinSerializedObjectMimeType | Infrastructure. Specifies the default content type for a binary object. This field is read-only. |
![]() ![]() | ByteArraySerializedObjectMimeType | Infrastructure. Specifies the default content type for a byte array object. This field is read-only. |
![]() ![]() | DefaultSerializedObjectMimeType | Infrastructure. Specifies the default content type for an object. This field is read-only. |
![]() ![]() | ResMimeType | Infrastructure. Specifies the content type of an XML resource. This field is read-only. |
![]() ![]() | ResourceSchema | Infrastructure. Specifies the schema to use in writing the XML file. This field is read-only. |
![]() ![]() | SoapSerializedObjectMimeType | Infrastructure. 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 Resources in .resx File Format.
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. For details about security demands, see Link Demands and Inheritance Demands. |
- SecurityAction::LinkDemand
for full trust for the immediate caller. This member cannot be used by partially trusted code.
- SecurityAction::InheritanceDemand
for full trust for inheritors. This member cannot be inherited by partially trusted code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
