-
Notifications
You must be signed in to change notification settings - Fork 218
/
CompilationResult.cs
46 lines (38 loc) · 1.24 KB
/
CompilationResult.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Microsoft.VisualStudio.Web.CodeGeneration
{
public class CompilationResult
{
public bool Success { get; set; }
public Assembly Assembly { get; set; }
public IEnumerable<string> ErrorMessages { get; set; }
public static CompilationResult FromAssembly(Assembly assembly)
{
if (assembly == null)
{
throw new ArgumentNullException(nameof(assembly));
}
return new CompilationResult()
{
Assembly = assembly,
Success = true
};
}
public static CompilationResult FromErrorMessages(IEnumerable<string> errorMessages)
{
if (errorMessages == null)
{
throw new ArgumentNullException(nameof(errorMessages));
}
return new CompilationResult()
{
ErrorMessages = errorMessages,
Success = false
};
}
}
}