Click here to Skip to main content
       

C#

 
QuestionC# app.config permission Pinmemberclassy_dog29-Jan-13 20:11 
AnswerRe: C# app.config permission PinmvpRichard MacCutchan29-Jan-13 22:15 
AnswerRe: C# app.config permission PinmemberLokoLuke30-Jan-13 1:35 
AnswerRe: C# app.config permission PinmemberShameel30-Jan-13 4:22 
GeneralRe: C# app.config permission Pinmemberjschell30-Jan-13 9:07 
QuestionC# linq to sql error Pinmemberclassy_dog29-Jan-13 20:10 
AnswerRe: C# linq to sql error PinmvpRichard MacCutchan29-Jan-13 22:13 
QuestionReference confusion Pinmemberyudhistira dewanata29-Jan-13 19:57 
I've just started learning C# yesterday, and I'm really confused with the reference system.
Can anyone please help explain to me what would happen here:
class Population{
       public void DuplicatePopulation(Population thatPop){
         x=thatPop.x;
       }
       public int x;
};
class GA{
public GA(){
       InitPop=new Population();
       CrossOverPop=new Population();
}
public Population FindPopID(int ID){
       switch(ID){
         case 1:return InitalPop;break;
	 case 2:return CrossOverPop;break;
	 default:break;
       }
       return InitialPop;//default
}
public void DuplicatePopulation(int FromID,int ToID){
	Population FROM,TO;
	FROM=FindPopID(FromID);
	TO=FindPopID(ToID);		         
        TO.DuplicatePopulation(FROM);
}
Population InitialPop,CrossOverPop;
};
 
class MainClass{
public void main(string[] args){
        GA GeneticAl=new GA();
        
        //Process here

        GeneticAl.DuplicatePopulation(1,2);
};
What I'm trying to do is duplicate population Init to Population CO. With this code, will the value of CrossOverPop.x == InitPop.x
Am I already passing by reference? or did i need to use the ref keyword?
AnswerRe: Reference confusion PinmvpAbhinav S29-Jan-13 20:01 
GeneralRe: Reference confusion PinmemberShameel30-Jan-13 4:26 
QuestionSerial Port Errors, User Messages PinmemberC-P-User-329-Jan-13 7:23 
AnswerRe: Serial Port Errors, User Messages Pinmemberjibesh29-Jan-13 12:57 
QuestionDynamic Reference to Dll Path PinmemberMember 461637929-Jan-13 2:53 
AnswerRe: Dynamic Reference to Dll Path PinmemberAlan N29-Jan-13 4:29 
AnswerRe: Dynamic Reference to Dll Path Pinmemberjschell29-Jan-13 14:50 
Question.NET Brush serialization/WYSIWIG [Solved] [modified] PinmemberAmlanjyoti Saikia29-Jan-13 1:32 
AnswerRe: .NET Brush serialization/WYSIWIG PinmemberBrisingr Aerowing29-Jan-13 4:12 
GeneralRe: .NET Brush serialization/WYSIWIG PinmemberAmlanjyoti Saikia30-Jan-13 2:54 
Questionhow to check the avaialbility of username from database PinmemberSanthosh V.T28-Jan-13 21:51 
AnswerRe: how to check the avaialbility of username from database PinmvpOriginalGriff28-Jan-13 22:17 
AnswerRe: how to check the avaialbility of username from database PinmemberPIEBALDconsult29-Jan-13 4:59 
AnswerRe: how to check the avaialbility of username from database PinmvpMarcus Kramer29-Jan-13 6:11 
QuestionLearning C# .Net - From where to start.? Pinmembermbatra3128-Jan-13 20:21 
AnswerRe: Learning C# .Net - From where to start.? PinmvpOriginalGriff28-Jan-13 22:23 
AnswerRe: Learning C# .Net - From where to start.? PinmvpRichard MacCutchan28-Jan-13 23:53 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 24 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid