1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 namespace System.Linq.Parallel.Tests 6 { 7 internal static class Labeled 8 { Label(string label, T item)9 public static Labeled<T> Label<T>(string label, T item) 10 { 11 return new Labeled<T>(label, item); 12 } 13 Order(this Labeled<ParallelQuery<T>> query)14 public static Labeled<ParallelQuery<T>> Order<T>(this Labeled<ParallelQuery<T>> query) 15 { 16 return Label(query.ToString() + "-Ordered", query.Item.AsOrdered()); 17 } 18 } 19 20 public struct Labeled<T> 21 { 22 private readonly string _label; 23 private readonly T _item; 24 25 public T Item 26 { 27 get { return _item; } 28 } 29 LabeledSystem.Linq.Parallel.Tests.Labeled30 internal Labeled(string label, T item) 31 { 32 _label = label; 33 _item = item; 34 } 35 ToStringSystem.Linq.Parallel.Tests.Labeled36 public override string ToString() 37 { 38 return _label; 39 } 40 } 41 } 42