Lecture Topics:
struct
enum
out
and ref
??
and ??=
Lab:
.NET categorizes types into reference types and value types, which differ in how they are stored and managed.
Stored on the managed heap, with variables holding references (pointers) to the data.
Examples: Classes, interfaces, delegates, strings, arrays, object
.
Behavior:
Example:
public class Employee
{
public string Name { get; set; }
}
Employee emp1 = new Employee { Name = "Alice" };
Employee emp2 = emp1; // emp2 references same object
emp2.Name = "Bob";
Console.WriteLine(emp1.Name); // Outputs: Bob