Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem of controling a listview in another form Pin
Luc Pattyn8-Jun-10 1:41
sitebuilderLuc Pattyn8-Jun-10 1:41 
GeneralRe: Problem of controling a listview in another form [Waiting online....] Pin
imbiz8-Jun-10 2:36
imbiz8-Jun-10 2:36 
GeneralRe: Problem of controling a listview in another form [Waiting online....] Pin
Pete O'Hanlon8-Jun-10 3:46
mvePete O'Hanlon8-Jun-10 3:46 
GeneralRe: Problem of controling a listview in another form [Waiting online....] Pin
imbiz8-Jun-10 4:23
imbiz8-Jun-10 4:23 
GeneralRe: Problem of controling a listview in another form [Waiting online....] Pin
Pete O'Hanlon8-Jun-10 4:43
mvePete O'Hanlon8-Jun-10 4:43 
GeneralOh,yeah!I did it! Pin
imbiz8-Jun-10 4:48
imbiz8-Jun-10 4:48 
QuestionIP address control Pin
SelvaKr8-Jun-10 1:00
SelvaKr8-Jun-10 1:00 
AnswerRe: IP address control Pin
Pete O'Hanlon8-Jun-10 1:03
mvePete O'Hanlon8-Jun-10 1:03 
GeneralRe: IP address control Pin
SelvaKr8-Jun-10 1:18
SelvaKr8-Jun-10 1:18 
AnswerRe: IP address control Pin
Johnny J.8-Jun-10 1:12
professionalJohnny J.8-Jun-10 1:12 
GeneralRe: IP address control Pin
SelvaKr8-Jun-10 1:19
SelvaKr8-Jun-10 1:19 
QuestionCrystal Report : Parameter Count Mismatch. Pin
saber.softs7-Jun-10 21:13
saber.softs7-Jun-10 21:13 
QuestionProblem in BackUp Pin
SajjadZare7-Jun-10 19:57
SajjadZare7-Jun-10 19:57 
AnswerRe: Problem in BackUp Pin
Md. Marufuzzaman7-Jun-10 21:37
professionalMd. Marufuzzaman7-Jun-10 21:37 
GeneralRe: Problem in BackUp Pin
SajjadZare7-Jun-10 22:01
SajjadZare7-Jun-10 22:01 
AnswerRe: Problem in BackUp Pin
Mycroft Holmes7-Jun-10 22:06
professionalMycroft Holmes7-Jun-10 22:06 
QuestionPass by value Pin
jon-807-Jun-10 18:58
professionaljon-807-Jun-10 18:58 
AnswerRe: Pass by value Pin
jgauffin7-Jun-10 20:08
jgauffin7-Jun-10 20:08 
GeneralRe: Pass by value Pin
jon-807-Jun-10 20:10
professionaljon-807-Jun-10 20:10 
AnswerRe: Pass by value Pin
Deepak-VS7-Jun-10 20:11
Deepak-VS7-Jun-10 20:11 
Pass by value and pass by reference:
Passing mechanisms decide how changes made to the parameter affect the caller.

Consider the following code snippet
Ex:

class MyClass {
public int value;
}

class Program {
..void funcPassbyValue(MyClass obj) {
obj.value = 10;
obj = new MyClass();
obj.value = 5;
}

..void func2PassbyRef(ref MyClass obj) {
obj.value = 10;
obj = new MyClass();
obj.value = 5;
}

.. Main() {
MyClass passedObj = new MyClass();

funcPassbyValue(passedObj );
Console.WriteLine(passedObj .value); //Outputs 10
func2PassbyRef(ref passedObj );
Console.WriteLine(passedObj .value); //Outputs 5
}
}

You can see both the methods funcPassbyValue && func2PassbyRef differ only in their signature.

Things which happen in common to both the methods: Any changes made to the argument to the method will be reflected back (condition is the changes are done while the parameter - in this case obj - is not changed to refer other object).

what does funcPassbyValue do differently: any changes made to the parameter (obj) will be local within the method and will not change (change here means to make it refer other object) the passedObj to refer other object.
Hope this clears your doublt.
what does func2PassbyRefdo differently: any changes made to the parameter (obj) will be reflected back to the caller in this case passedObj is changed to refer to the new object created inside the method.
QuestionMessage Removed Pin
7-Jun-10 18:51
SajjadZare7-Jun-10 18:51 
AnswerRe: BackUp PinPopular
Mycroft Holmes7-Jun-10 19:21
professionalMycroft Holmes7-Jun-10 19:21 
QuestionNew posts emailed - please be kind Pin
mprice2147-Jun-10 17:52
mprice2147-Jun-10 17:52 
AnswerRe: New posts emailed - please be kind Pin
Luc Pattyn7-Jun-10 17:59
sitebuilderLuc Pattyn7-Jun-10 17:59 
GeneralRe: New posts emailed - please be kind Pin
mprice2147-Jun-10 18:09
mprice2147-Jun-10 18:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.