-
Notifications
You must be signed in to change notification settings - Fork 368
/
DisplayEvent.cs
33 lines (27 loc) · 1.06 KB
/
DisplayEvent.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
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Microsoft.DotNet.Interactive.Commands;
namespace Microsoft.DotNet.Interactive.Events
{
public abstract class DisplayEvent : KernelEvent
{
protected DisplayEvent(
object value,
KernelCommand command,
IReadOnlyCollection<FormattedValue> formattedValues = null,
string valueId = null) : base(command)
{
Value = value;
FormattedValues = formattedValues ?? Array.Empty<FormattedValue>();
ValueId = valueId;
}
[JsonIgnore]
public object Value { get; }
public IReadOnlyCollection<FormattedValue> FormattedValues { get; }
public string ValueId { get; }
public override string ToString() => $"{GetType().Name}: {Value?.ToString().TruncateForDisplay()}";
}
}