-
Notifications
You must be signed in to change notification settings - Fork 87
/
ComposedPartDiagnostic.cs
43 lines (35 loc) · 1.44 KB
/
ComposedPartDiagnostic.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
// Copyright (c) Microsoft. All rights reserved.
namespace Microsoft.VisualStudio.Composition
{
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ComposedPartDiagnostic
{
public ComposedPartDiagnostic(ComposedPart part, string formattedMessage)
: this(ImmutableHashSet.Create(part), formattedMessage)
{
}
public ComposedPartDiagnostic(ComposedPart part, string unformattedMessage, params object[] args)
: this(part, string.Format(CultureInfo.CurrentCulture, unformattedMessage, args))
{
}
public ComposedPartDiagnostic(IEnumerable<ComposedPart> parts, string formattedMessage)
{
Requires.NotNull(parts, nameof(parts));
Requires.NotNullOrEmpty(formattedMessage, nameof(formattedMessage));
this.Parts = ImmutableList.CreateRange(parts);
this.Message = formattedMessage;
}
public ComposedPartDiagnostic(IEnumerable<ComposedPart> parts, string unformattedMessage, params object[] args)
: this(parts, string.Format(CultureInfo.CurrentCulture, unformattedMessage, args))
{
}
public IReadOnlyCollection<ComposedPart> Parts { get; private set; }
public string Message { get; private set; }
}
}