Re: Huge string arrays in C#
- From: "Philipp Schumann" <phil@xxxxxxxxx>
- Date: Wed, 25 May 2005 15:03:43 +0100
True ... =)
"Jon Shemitz" <jon@xxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:4293DF76.D92B91C3@xxxxxxxxxxxxxxxxxxxx
> Philipp Schumann wrote:
>
>> in addition, string is a reference type, not a value type, so the casting
>> "overhead" should in fact be minimal, if at all, noticable (as compared
>> to
>> the "boxing" that would occur with value types when cast to a reference
>> type, Object). As you know, reference types are all representationally
>> equivalent for the purposes of the ArrayList, they are just pointers. I
>> believe it is no casting at all in this case, it's simple
>> inheritance---classB inherits classA, if classA is the type of a method
>> parameter and I pass a classB, there is no casting involved, is there??
>> Same
>> here, since any type _inherits_ from Object. 'Boxing' is the special case
>> for non-reference (ie value) types, but does not apply to strings.
>
> There is no cast to assign a string to an object variable, but you do
> have to cast - as Bob mentioned - "to get the strings back out."
>
> The casting is not insanely expensive, but it is required whenever you
> assign an object from an ArrayList to a string variable. Since string
> descends directly from object, the test isn't as expensive as when you
> cast an object to some class with several ancestors between it and the
> root, but it's not free.
>
> --
>
> www.midnightbeach.com
.
- References:
- Huge string arrays in C#
- From: Emil _ DK
- Re: Huge string arrays in C#
- From: Bob Grommes
- Re: Huge string arrays in C#
- From: Philipp Schumann
- Re: Huge string arrays in C#
- From: Jon Shemitz
- Huge string arrays in C#
- Prev by Date: Re: Huge string arrays in C#
- Next by Date: Re: Huge string arrays in C#
- Previous by thread: Re: Huge string arrays in C#
- Next by thread: Re: Huge string arrays in C#
- Index(es):
Relevant Pages
|