Re: String Reference Type
- From: bruce barker <nospam@xxxxxxxxxx>
- Date: Sun, 10 Feb 2008 17:34:36 -0800
no heap is used.
the variable x is on the stack and is the value, rather than reference to the value. the variable MyValue being a class static value, is allocated in the static class definition structure, and again is the value, not a pointer to the value.
in .net numerics, bools, dates, structures and enums are value types, everything else is a true object and thus a reference type.
-- bruce (sqlwork.com)
RN1 wrote:
On Feb 10, 4:38 am, "Jonathan Wood" <jw...@xxxxxxxxxxxxxxxx> wrote:.Lars,
No, Strings in Pascal (and ADA as I reacll) are tru types.This appears to be to me but I don't know what "no" refers to, or what "tru
types" are.
I could be wrong but it seems to me you are confusing terms. I'm not that
familiar with Delphi but a reference in C++ is different from a .NET
reference type. I don't know the exact criteria used to determine value or
reference type, but to me a reference type is a pointer, and so any type
that requires a pointer seems it would be a good candidate. And as far as
I'm concerned, all strings require pointers, whether they are made available
to the language that uses them or not. (Certainly, it wouldn't make sense to
ever store a string in a register or even on the stack.)
Don't know about C# but I hope the compiler takes care of this. ByAccording tohttp://www.knowdotnet.com/articles/referencetypes2.html, "One
references or not is not of interest. What is of interest is if you have
the option to use call by value for strings or if all parameters are
treated as references. Can you use call by value in C# how do you use call
by value?
of the most common mistakes developers make when learning .NET is confusing
Reference and Value Types with Passing values by Reference or Value." Again,
I think you are confusing terms.
--
Jonathan Wood
SoftCircuits Programminghttp://www.softcircuits.com
OK...now suppose I have the following code:
<script runat="server">
Class MyInt
Public MyValue As Integer
End Class
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim x As New MyInt
...................
...................
...................
End Sub
</script>
If I am not wrong, the Dim line in the Page_Load sub "creates space in
the heap & returns a pointer (say, 0x000001)". To whom does the Dim
line return the pointer?
Please correct me if I am wrong.
- Follow-Ups:
- Re: String Reference Type
- From: Lars
- Re: String Reference Type
- References:
- String Reference Type
- From: RN1
- Re: String Reference Type
- From: Jonathan Wood
- Re: String Reference Type
- From: Lars
- Re: String Reference Type
- From: Jonathan Wood
- Re: String Reference Type
- From: RN1
- String Reference Type
- Prev by Date: Re: ListView in ASP.NET/.NET 3.5
- Next by Date: RE: AJAX client script bug with validator
- Previous by thread: Re: String Reference Type
- Next by thread: Re: String Reference Type
- Index(es):
Relevant Pages
|
Loading