On Wed, Apr 16, 2008 at 5:26 PM, Sébastien Lorion
<[EMAIL PROTECTED]> wrote:
> Is there a way to know the managed size of a type parameter at runtime
>  ? What I want to do is something like:
>
>  int typeSize = sizeof(T); // pseudo-code
>
>  Buffer.BlockCopy(source, sourceIndex * typeSize, destination,
>  destinationIndex * typeSize, length * typeSize)

Presumably, T is something marshal-friendly or you're in a state of
sin already.  As such, you should be able to say
Marshal.SizeOf(typeof(T));

--
Curt Hagenlocher
[EMAIL PROTECTED]

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to