My little mind cannot come up with an elegant solution to this problem. Suppose I have a class like this:
public class Foo<T>
{
public RecordType Type { get; set; }
public T Value { get; set; }
}
Where it RecordTypemight look something like this:
public enum RecordType
{
EmptyRecord,
BooleanRecord,
IntegerRecord,
StringRecord,
ByteRecord
}
The goal is to evenly process IEnumerable<Foo<T>>for iteration and / or enable RecordTypeand execute an action, while avoiding boxing of internal types, if at all possible. Also, it would be nice to use a factory to create these Foousing the factory method.
I was looking for a few quick implementations of generality in a base class or interface, and none of what I came up with answered this seemingly very simple problem elegantly.
:
, - .Value, .