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
Maha
NA
0
326k
Value vs. Reference
Sep 4 2012 1:52 PM
I tried to develop a program to understand the concept given in the following website (http://en.csharp-online.net/Value_vs_Reference). This program is incomplete please complete this program to demonstrate the concept given in the website.
using System;
namespace Value_vs_Reference
{
class Program
{
static void Main(string[] args)
{
ReferenceType refType = new ReferenceType();
ValueType valueType = new ValueType();
refType.setR(5);
valueType.setV(10);
Console.WriteLine("{0} {1}", refType.getR(), valueType.getV());
Console.WriteLine("\nAfter assigning value");
refType.setR(6);
valueType.setV(11);
Console.WriteLine("{0} {1}", refType.getR(), valueType.getV());
Console.ReadKey();
}
}
}
class ReferenceType
{
int num;
public void setR(int num)
{
this.num = num;
}
public int getR()
{
return num;
}
}
struct ValueType
{
int num;
public void setV(int num)
{
this.num = num;
}
public int getV()
{
return num;
}
}
Reply
Answers (
2
)
C# proxy class
keyboardcontrol form is accessing an other form then i click on keyboard keys in keyboardcontrols that key value should be reflected in another form