Matteo,
You can't, at least not at compile time using constraints. You could
perform a check against the type parameter at run time in the static
constructor for the type and see if it is Int32, Double, etc, etc.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Matteo Migliore" <ma*****************@gmail.comwrote in message
news:ug*************@TK2MSFTNGP02.phx.gbl...
Hi.
I want to costraint a generics T to be a number (Int32, Double, Byte
etc...) but
how I can do?
I need beacuse I want to use arithmetic operators (+, -...).
Thx! ;-)
--
Matteo Migliore.
Blog: http://blogs.ugidotnet.org/matteomigliore