TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kevin Andersson
NA
3
0
ref and value types
Dec 2 2005 3:30 AM
Hi,
Yesterday I made a Blog about value and reference types and how they act. A string is also a reference type but does it act like an reference type?
some code:
Person p = new Person( "Jan" );
Persoon refP = p;
p.FirstName = "Kevin";
Console.WriteLine("My First person = " + p.FirstName);
Console.WriteLine("My reference= " + refP .FirstName);
Person is a class that is also an reference type. Now my code with a string:
string
test;
test =
"myFirstTest"
;
string
test2 = test;
test2 =
"mySecondTest"
;
MessageBox
.Show(
"test = "
+ test +
" en test2 = "
+ test2);
my output is not the output that a expect from a referencetype? How come, I don't know, could it be because I don't make a instance with the keyword new??
This is maybe a simple question but actually I don't know the answer. Can someone figure this out for me!
thanks K
Reply
Answers (
3
)
urgent, please help managed directx
Tab & Grid questions