Re: Datasets? Properties? Values?
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 08/20/04
- Next message: Jon Skeet [C# MVP]: "Re: Datasets? Properties? Values?"
- Previous message: hplloyd: "RE: Problem for deploying Windows Forms Application with Crystal Repor"
- In reply to: Cor Ligthert: "Re: Datasets? Properties? Values?"
- Next in thread: Joey Callisay: "Re: Datasets? Properties? Values?"
- Reply: Joey Callisay: "Re: Datasets? Properties? Values?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Aug 2004 08:57:40 +0100
Cor Ligthert <notfirstname@planet.nl> wrote:
> > Not really. There's nothing special about string here. It's just an
> > immutable object, like any other immutable object one could design.
> >
> > There *are* ways in which the CLR treats strings in a special manner,
> > but this isn't one of them.
>
> What do I miss?
>
> In my opinion is the reason is from the behaviour is that the string is
> passed by its value of the pointer to its starting adres and by a change get
> a new pointer.
>
> While the dataset keeps its own pointer
No, DataSet doesn't "keep its own pointer". In both cases, they're just
reference types. You can't change the contents of a string, you can
change the contents of a DataSet. In both cases, changing the value of
a variable won't change the object though. In other words:
DataSet x = GetSomeDataSet();
x = GetSomeOtherDataSet();
doesn't change either DataSet - it just changes the value of x from a
reference to one DataSet to a reference to another DataSet.
> Your answer is therefore not wrong, however I would not completly answer it
> like you do. There is something special to the string, it is immutable and
> therefore it gets evertime a new pointer.
But being immutable has nothing to do with the CLR. You can write your
own immutable classes which behave exactly the same way.
> As we disscussed before not all systems have immutable strings, so you may
> call this something "special" from Net. (And let us not discuss about the
> word special, maybe is not immutable at the moment "special").
>
> Correct me when I am "completly" wrong?
What's wrong is the impression that strings are handled differently to
other types in this respect. They're not at all. String is a reference
type which happens to be immutable. The immutability just means there
isn't any way to change the contents of the object, but that doesn't
mean the CLR handles it differently or anything like that. (Not in this
respect, anyway - interning etc is a different matter.)
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Jon Skeet [C# MVP]: "Re: Datasets? Properties? Values?"
- Previous message: hplloyd: "RE: Problem for deploying Windows Forms Application with Crystal Repor"
- In reply to: Cor Ligthert: "Re: Datasets? Properties? Values?"
- Next in thread: Joey Callisay: "Re: Datasets? Properties? Values?"
- Reply: Joey Callisay: "Re: Datasets? Properties? Values?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|