Re: Huge string arrays in C#

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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


.



Relevant Pages

  • Re: what is this c# syntax?
    ... You mention casting an array to a string. ... You can't cast an array to a string because one is not an ancestor of the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: casting vs. using the "Convert" methods?
    ... When I was talking of casting I was of course only talking about casting ... because it was a conversion and not a cast. ... > cast operator that converted a string to an int. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to cast an Object to Double?
    ... This means you're trying to cast a String into a Double. ... Casting is different than parsing. ... you can cast an animal to cat if it is a cat but you can't cast an ...
    (comp.lang.java.programmer)
  • Re: select case does not work ... why?
    ... This is probably a casting issue in that notification_type 3 is not a string or is "03" or some such variation. ... > select case param ... I believe the colon is used to separate two statements on the same line. ...
    (microsoft.public.scripting.vbscript)
  • TALENT MANAGEMENT tables - (obscenely long)
    ... CASTING DIRECTORS, CASTING STUDIOS, MANAGERS and OTHER_PEOPLE seems to make ... breakdown_id the unique ID used to reference this breakdown. ... title (string) the title of the breakdown. ... >Assistants, Casting Directors, Casting Assistants, Directors, Producers, ...
    (microsoft.public.access.tablesdbdesign)