It *could* be every type ... It happens it is pretty similar, I admit
I did make a table like you did.
Array.Copy seems to be as fast as Buffer.BlockCopy, but if anyone on
this list has a different experience, please let me know.
I know sizeof(T) could not work and I was writing that only to expr
On Wed, Apr 16, 2008 at 10:10 PM, Sébastien Lorion
<[EMAIL PROTECTED]> wrote:
> On 4/17/08, Curt Hagenlocher <[EMAIL PROTECTED]> wrote:
> > On Wed, Apr 16, 2008 at 8:31 PM, Sébastien Lorion
> >
> > <[EMAIL PROTECTED]> wrote:
> >
> > > I want the managed size, so Marshal.SizeOf does not return the c
On 4/17/08, Curt Hagenlocher <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 16, 2008 at 8:31 PM, Sébastien Lorion
>
> <[EMAIL PROTECTED]> wrote:
>
> > I want the managed size, so Marshal.SizeOf does not return the correct
> > value.
> >
> > For example, sizeof(char) returns 2 and Marshal.SizeOf(typeof
nced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Curt Hagenlocher
> Sent: Wednesday, April 16, 2008 9:07 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] Getting managed size of a generic
> parameter
>
> On Wed, Apr 16, 2008 at 8:31 PM,
On Wed, Apr 16, 2008 at 8:31 PM, Sébastien Lorion
<[EMAIL PROTECTED]> wrote:
> I want the managed size, so Marshal.SizeOf does not return the correct value.
>
> For example, sizeof(char) returns 2 and Marshal.SizeOf(typeof(char)) returns
> 1.
Huh. So it does. Are there any other types for which
I want the managed size, so Marshal.SizeOf does not return the correct value.
For example, sizeof(char) returns 2 and Marshal.SizeOf(typeof(char)) returns 1.
Sébastien
On 4/16/08, Curt Hagenlocher <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 16, 2008 at 5:26 PM, Sébastien Lorion
> <[EMAIL PROTECTED
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, destina
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)
Thanks,
--
Sébastien
www.sebastie