How often are you into a fromdate-todate scenario.
Or perhaps a fromValue-toValue.
How do you do those times?
I use one of those commonly,
T = ObjectType (DateTime, int, string..)
Dictionary<T,T> (used with .Single())
T fromDate;
T toDate;
T[] comparison;
Which are directly used or returned by a method.
Very Very seldom i stand create a whole object
public struct T
{
T fromDate { get; set;}
T toDate { get; set;}
}
public Method T(params)
{
..some operations..
return T { fromDate = someBegin, toDate = someEnd };
}
Everytime time, I want a stright and simple KeyValuePair<T,T> test;. The problem to me, using KeyValuePair, is missleading if used this way?? If I see a KeyValuePair in someones code, i look at the variable like “index 10, category books”.
What are your suggestion?
If you have .NET Framework 4, I’d suggest to use
Tuple<T, T>instead, since it does not imply a key-value-relationship likeKeyValuePair.