System.Text.RegularExpressions.RegexCompiler.CompileToAssembly C# (CSharp) Method

CompileToAssembly() private method

private CompileToAssembly ( RegexCompilationInfo regexes, AssemblyName an, CustomAttributeBuilder attribs, String resourceFile, Evidence evidence ) : void
regexes RegexCompilationInfo
an System.Reflection.AssemblyName
attribs System.Reflection.Emit.CustomAttributeBuilder
resourceFile String
evidence Evidence
return void
        internal static void CompileToAssembly(RegexCompilationInfo[] regexes, AssemblyName an, CustomAttributeBuilder[] attribs, String resourceFile, Evidence evidence) {
            RegexTypeCompiler c = new RegexTypeCompiler(an, attribs, resourceFile, evidence);
        
            for (int i=0; i<regexes.Length; i++) {
                String pattern = regexes[i].Pattern;
                RegexOptions options = regexes[i].Options;
                String fullname;
                if (regexes[i].Namespace.Length == 0)
                    fullname = regexes[i].Name;
                else
                    fullname = regexes[i].Namespace + "." + regexes[i].Name;
        
                RegexTree tree = RegexParser.Parse(pattern, options);
                RegexCode code = RegexWriter.Write(tree);
        
                Type factory;
        
                new ReflectionPermission(PermissionState.Unrestricted).Assert();
                try {
                    factory = c.FactoryTypeFromCode(code, options, fullname);
                    c.GenerateRegexType(pattern, options, fullname, regexes[i].IsPublic, code, tree, factory);
                }
                finally {
                    CodeAccessPermission.RevertAssert();
                }
            }
        
            c.Save();
        }