using System;
namespace WhateverNamespaceYouWant
{
///
/// This is a generic Pair class.
///
public class Pair
{
public Pair()
{
}
public Pair(T firstValue, U secondValue)
{
FirstValue = firstValue;
SecondValue = secondValue;
}
public T FirstValue { get; set; }
public U SecondValue { get; set; }
}
}
I don't have a lot to say, but this is my little bit.
Wednesday, June 16, 2010
Minimal C# Generic Pair Class
Here is an example of a Pair class for C#. This could be trivially modified or subclassed to provide a dictionary entry, other key/value pair, or larger number of values.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment