System.Reflection.Emit.AssemblyBuilder.DefineResource Method

Defines a standalone managed resource for this assembly. Attributes can be specified for the managed resource.

Syntax

public System.Resources.IResourceWriter DefineResource (string name, string description, string fileName, System.Reflection.ResourceAttributes attribute)

Parameters

name
The logical name of the resource.
description
A textual description of the resource.
fileName
The physical file name (.resources file) to which the logical name is mapped. This should not include a path.
attribute
The resource attributes.

Returns

A System.Resources.ResourceWriter object for the specified resource.

Remarks

Fine-grain resources can be added with the returned System.Resources.ResourceWriter by calling System.Resources.ResourceWriter.AddResource(string, string).

fileName should not be the same as that of any other persistable module, standalone managed resource, or the standalone manifest file.

The runtime calls the System.Resources.ResourceWriter.Close method when the dynamic assembly is saved.

Note:

Starting with the net_v20sp1_long, this member no longer requires System.Security.Permissions.ReflectionPermission with the System.Security.Permissions.ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the net_v35_long or later.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0