Avatar of IzzyTwinkly
IzzyTwinkly
Flag for United States of America asked on

what does 'this' do?

From the code below, I don't know why 'this' has been used in the method since the result is the same without it.  I've always told that 'this' means 'current object'.  Is it still a case here?  What is the current obejct here?  Why would we use 'this' here?

public int[] copyArray(int[] source)
{
        this.des = new int[source.Length];
        for (int i = 0; i < source.Length; i++)
            this.des[i] = source[i];
        return this.des;
}
C#

Avatar of undefined
Last Comment
Anurag Thakur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CuteBug

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Imperdonato

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Anurag Thakur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck