Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // What will be the output in console?
- using System;
- public class User
- {
- public string Name { get; }
- public User(string name)
- {
- this.Name = name;
- }
- }
- public class Program
- {
- public static void ChangeUser(User u)
- {
- u = new User("User 2");
- }
- public static void Main()
- {
- var user = new User("User 1");
- ChangeUser(user);
- Console.WriteLine(user.Name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment