System.CodeDom.Compiler.CompilerErrorCollection.Add C# (CSharp) Method

Add() public method

public Add ( CompilerError value ) : int
value CompilerError
return int
        public int Add(CompilerError value) {
            return List.Add(value);
        }
        

Usage Example

Esempio n. 1
0
        public override CompilerResults CompileAssemblyFromFile(CompilerParameters options, params string[] fileNames)
        {
            var units = new CodeCompileUnit[fileNames.Length];
            var errors = new CompilerErrorCollection();
            var syntax = new Parser(options);

            for (int i = 0; i < fileNames.Length; i++)
            {
                try
                {
                    units[i] = syntax.Parse(new StreamReader(fileNames[i]), fileNames[i]);
                }
            #if !DEBUG
                catch (ParseException e)
                {
                    errors.Add(new CompilerError(e.Source, e.Line, 0, e.Message.GetHashCode().ToString(), e.Message));
                }
                catch (Exception e)
                {
                    errors.Add(new CompilerError { ErrorText = e.Message });
                }
            #endif
                finally
                {
                }
            }

            var results = CompileAssemblyFromDom(options, units);
            results.Errors.AddRange(errors);

            return results;
        }
All Usage Examples Of System.CodeDom.Compiler.CompilerErrorCollection::Add