This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Pair.cs
52 lines (45 loc) · 1.57 KB
/
Pair.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
47
48
49
50
51
52
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// Pair.cs
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
namespace System.Linq.Parallel
{
/// <summary>
/// A pair just wraps two bits of data into a single addressable unit. This is a
/// value type to ensure it remains very lightweight, since it is frequently used
/// with other primitive data types as well.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="U"></typeparam>
internal struct Pair<T, U>
{
// The first and second bits of data.
internal T _first;
internal U _second;
//-----------------------------------------------------------------------------------
// A simple constructor that initializes the first/second fields.
//
public Pair(T first, U second)
{
_first = first;
_second = second;
}
//-----------------------------------------------------------------------------------
// Accessors for the left and right data.
//
public T First
{
get { return _first; }
set { _first = value; }
}
public U Second
{
get { return _second; }
set { _second = value; }
}
}
}