Some questions

  • Thread starter Thread starter Zoury
  • Start date Start date
Z

Zoury

Hi! :O)

I'de like to know how date types are hold in memory. Is there any
documentation on this?

for example, is System.String a BSTR? or int[] a SAFEARRAY?

thanks a lot!
 
Yanick,

It is possible that the interal representation of a string is BSTR (on
Microsoft platforms), however, I doubt it. This would require a fixed slot
in memory, something that the CLR generally doesn't like. My guess is that
it stores the array of characters which the object accesses.

Arrays are probably not safearrays either. Generally speaking, I do not
think that .NET uses COM types to represent basic structures such as
strings, or arrays.

As for dates, it seems that the internal represenation of the date is in
ticks (milliseconds).

Hope this helps.
 
Hi Nicholas! :O)

Thanks for your input!

Concerning System.String I think your right about it being hold as a char
array.. or else it shouldn't let you do this, right? :

//***
MessageBox.Show("test"[0].ToString());
//***




I have another question about a whole other topic.
In VB (and probably C++) we used Win32 APIs really often. Is this a good or
a bad practice in .NET? Will these functions still be supported for a long
to come?

Thanks again
 
Zoury,

Well, even if it was a BSTR, you could do that. The string class would
find the point in memory, and then offset that pointer by whatver the index
was (using pointer arithmetic with pointers to a unicode character). Then,
when it has the bytes, it just returns a character returned from those
bytes.
 
Thanks for your input!

Concerning System.String I think your right about it being hold as a char
array.. or else it shouldn't let you do this, right? :

//***
MessageBox.Show("test"[0].ToString());
//***

No - it's not an array of characters in that way. The [0] there is just
calling the indexer.
I have another question about a whole other topic.
In VB (and probably C++) we used Win32 APIs really often. Is this a good or
a bad practice in .NET? Will these functions still be supported for a long
to come?

I would use a .NET API as much as you can - only when something isn't
available in .NET would I use Win32.
 
Back
Top