< Summary

Information
Class: MyNet.Observable.LabeledValue<T>
Assembly: MyNet.Observable
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Observable/Base/LabeledValue.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 30
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ToString()50%22100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Observable/Base/LabeledValue.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="LabeledValue.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7#pragma warning disable IDE0130 // Namespace does not match folder structure
 8namespace MyNet.Observable;
 9#pragma warning restore IDE0130 // Namespace does not match folder structure
 10
 11/// <summary>
 12/// Pairs a value with a culture-bound display label (without wrapper inheritance).
 13/// </summary>
 14/// <typeparam name="T">The value type.</typeparam>
 15/// <param name="Value">The underlying value.</param>
 16/// <param name="DisplayName">The localized label provider.</param>
 17public sealed record LabeledValue<T>(T Value, IObservableValue<string> DisplayName)
 18{
 19    /// <summary>
 20    /// Initializes a new instance of the <see cref="LabeledValue{T}"/> class with a resource key label.
 21    /// </summary>
 22    /// <param name="value">The underlying value.</param>
 23    /// <param name="resourceKey">The translation resource key.</param>
 24    public LabeledValue(T value, string resourceKey)
 625        : this(value, new LocalizedString(resourceKey)) { }
 26
 27    /// <inheritdoc />
 328    public override string ToString() => DisplayName.Value ?? string.Empty;
 29}
 30

Methods/Properties

.ctor(T,System.String)
ToString()