Compiles one or more specified System.Text.RegularExpressions.Regex objects and a specified resource file to a named assembly with the specified attributes.
The Regex.CompileToAssembly(RegexCompilationInfo[], System.Reflection.AssemblyName, System.Reflection.Emit.CustomAttributeBuilder[], string) method generates a .NET Framework assembly in which each regular expression defined in the regexinfos array is represented by a class. Typically, the Regex.CompileToAssembly(RegexCompilationInfo[], System.Reflection.AssemblyName, System.Reflection.Emit.CustomAttributeBuilder[], string) method is called from a separate application that generates an assembly of compiled regular expressions. Each regular expression included in the assembly has the following characteristics:
It is derived from the System.Text.RegularExpressions.Regex class.
It is assigned the fully qualified name that is defined by the fullnamespace and name parameters of its corresponding System.Text.RegularExpressions.RegexCompilationInfo object.
It has a default (or parameterless) constructor.
Ordinarily, the code that instantiates and uses the compiled regular expression is found in an assembly or application that is separate from the code that creates the assembly.
Because the erload:System.Text.RegularExpressions.Regex.CompileToAssembly method generates a .NET Framework assembly from a method call instead of using a particular language's class definition keyword (such as class in C# or Class…End Class in Visual Basic), it does not allow .NET Framework attributes to be assigned to the assembly by using the development language's standard attribute syntax. The attributes parameter provides an alternative method for defining the attributes that apply to the assembly. For each attribute that you want to apply to the assembly, do the following:
[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]You can then pass an array of these System.Reflection.Emit.CustomAttributeBuilder objects instead of the attributes parameter to the Regex.CompileToAssembly(RegexCompilationInfo[], System.Reflection.AssemblyName, System.Reflection.Emit.CustomAttributeBuilder[], string) method.