From the course: C# Essential Training 1: Types and Control Flow

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Cloning and copying objects

Cloning and copying objects

- Let's look at how these different types work. So reference types or classes, structs, value types, and then the records. Got a method here, just back out of my program.cs, called classes, and I'm going to create an employee, I'm going to initialize it. So I've got a name. Notice the age here, got a birth date back in 1971, means 50 years old with an ID of one, and then here's where we start working with those reference types. So on line 22, I define another variable called other and I set it equal to me. Then I change the first name and the age on the other variable. Now what's going to get written out here on line 27. If I read out me.FirstName and age years old, as well as other first name and age years old. So think about what's the original variable me and what's happened now that I have another reference, this other that points to it. So let's run that quick. Let's see if he got it right. Let's look at the first couple lines here. It says Bizarro Matt is 39, but Bizarro Matt is…

Contents