MinMaxArray
- From: Ondrej Medek <xmedeko@xxxxxxxxx>
- Date: Wed, 9 Jul 2008 02:22:36 -0700 (PDT)
Hi,
I would like to have a generic class MinMaxArray<T>, which is a
wrapper around an array of T[] and computes minimum, maximum, and
average value from the array T[]. I need it only for the basic numeric
types (int, float, etc.).
I had problems with operators < > + and /, when I was computing
minimum, maximum and average values. I have errors like "Operator ...
cannot be applied to operans of type 'T' and 'T'." So, I use
IComparer<T> instead of operators < >, but I do not know, how to
compute average value (sum and divide) for a generic numeric type T.
Is there any easy way to do it? Disable the type checking in the
compile time?
Thx
.
- Follow-Ups:
- Re: MinMaxArray
- From: Jeroen Mostert
- Re: MinMaxArray
- From: Marc Gravell
- Re: MinMaxArray
- From: Marc Gravell
- Re: MinMaxArray
- Prev by Date: Re: Pointless Exception Handling?
- Next by Date: Re: Passing information between Forms--is there any other way than using parametized constructors?
- Previous by thread: mage, publicKeyToken
- Next by thread: Re: MinMaxArray
- Index(es):
Relevant Pages
|